#include #include #include "Valu.h" #include "verilated.h" int main(int argc, char **argv) { Verilated::commandArgs(argc, argv); Valu *tb = new Valu; printf("Pass-through test\n"); tb->a = 0x87; tb->b = 0x02; tb->op = 0x0; tb->eval(); printf("out: %2x\n should be 87\n", tb->out); printf("And-test\n"); tb->op = 0x1; tb->eval(); printf("out: %2x\n should be 2\n", tb->out); printf("Or-test\n"); tb->op = 0x2; tb->eval(); printf("out: %2x\n should be 87\n", tb->out); printf("Xor-test\n"); tb->op = 0x3; tb->eval(); printf("out: %2x\n should be 85\n", tb->out); printf("Add-test\n"); tb->op = 0x4; tb->eval(); printf("out: %2x\n should be 89\n", tb->out); printf("Subtract-test\n"); tb->op = 0x5; tb->eval(); printf("out: %2x\n should be 85\n", tb->out); }