35 lines
777 B
C++
35 lines
777 B
C++
#include "vcppd/builder.h"
|
|
|
|
#include "vcppd/scope.h"
|
|
|
|
#include <ctime>
|
|
#include <iomanip>
|
|
|
|
using namespace vcppd;
|
|
|
|
Builder::Builder(std::ostream& stream) :
|
|
stream(stream)
|
|
{
|
|
auto t = std::time(nullptr);
|
|
auto tm = *std::localtime(&t);
|
|
|
|
stream << "$version Generated by vcppd $end" << std::endl;
|
|
stream << "$date " << std::put_time(&tm, "%A %B %e %T %Y") << " $end"
|
|
<< std::endl;
|
|
stream << "$timescale 1ns $end" << std::endl;
|
|
}
|
|
|
|
Vcd Builder::build() const
|
|
{
|
|
stream << "$enddefinitions $end" << std::endl;
|
|
return Vcd(*this);
|
|
}
|
|
|
|
Scope<Builder> Builder::scope(const std::string& name)
|
|
{
|
|
stream << "$scope module " << name << " $end" << std::endl;
|
|
return Scope<Builder>(name, *this);
|
|
}
|
|
|
|
void Builder::unscope() { stream << "$upscope $end" << std::endl; }
|