#include "ca_model.h"
#include "ru_common.h"
#include "print_log.h"
#include "ca_program.h"
class ADDER : public CA_MODEL {
public:
pINPUT A1;
pINPUT A2;
pOUTPUT Z;
ADDER(const CA_MODEL* parent, const std::string &name, const PrintOptions& printOptions = 0) :
CA_MODEL(parent, name, "ADDER", printOptions)
{}
void init(int w) {
INPUT(A1, w);
INPUT(A2, w);
OUTPUT(Z, w);
Z = E(A1) + E(A2);
}
};
int main() {
PrintOptions po(mask(optPrintIO), PrintIOFormat::TXT);
ADDER a(0, "a", po);
a.init(64);
//CA_Program prog;
//prog.init(&a);
a.genVerilog();
a.genVerilogTestbench();
a.reset();
int flags = CA_MODEL::FLAG_DEBUG | CA_MODEL::FLAG_PRINT | CA_MODEL::FLAG_GEN_VERILOG;
a.initPrintData(flags);
a.nextClock(flags);
a.nextClock(flags);
//a.Test(1,0,32);
return 0;
}
Do'stlaringiz bilan baham: |