packages feed

clashilator-0.1.0: template/Impl.cpp.mustache

#include "VSim.h"
#include "verilated.h"
#include "Impl.h"

vluint64_t main_time = 0;

double sc_time_stamp ()
{
    return main_time;
}

VSim* vinit()
{
    // Verilated::commandArgs(0, 0);
    return new VSim();
}

void vshutdown(VSim *top)
{
    delete top;
}

void vstep(VSim* top, const INPUT* input, OUTPUT* output)
{
    {{#inPorts}}
    top->{{cName}} = input->{{cName}};
    {{/inPorts}}

    {{#clock}}
    top->{{cName}} = true;
    {{/clock}}
    top->eval();
    ++main_time;
    {{#clock}}
    top->{{cName}} = false;
    top->eval();
    ++main_time;
    {{/clock}}

    {{#outPorts}}
    output->{{cName}} = top->{{cName}};
    {{/outPorts}}
}