summaryrefslogtreecommitdiff
path: root/tb/rv2insn_tb.sv
diff options
context:
space:
mode:
Diffstat (limited to 'tb/rv2insn_tb.sv')
-rw-r--r--tb/rv2insn_tb.sv42
1 files changed, 42 insertions, 0 deletions
diff --git a/tb/rv2insn_tb.sv b/tb/rv2insn_tb.sv
new file mode 100644
index 0000000..14a0249
--- /dev/null
+++ b/tb/rv2insn_tb.sv
@@ -0,0 +1,42 @@
+`include "common.svh"
+
+module rv2insn_tb;
+
+logic clk;
+logic rst_n;
+
+xlen_t pc;
+logic[7:0] rv[4*4];
+insn_t[3:0] que;
+
+function automatic rv_t[3:0] unp2p(logic[7:0] in[4*4]);
+ logic [15:0][7:0] conversion;
+ for (int i = 0; i < 4 * 4; ++i) begin
+ conversion[i] = in[i];
+ end
+ return conversion;
+endfunction
+
+rv2insn #(
+ .QUE_DEPTH(4),
+ .ALU_COUNT(2)
+) rv2insn (
+ .clk_i(clk),
+ .rst_ni(rst_n),
+ .pc_i(pc),
+ .rv_i(unp2p(rv)),
+ .que_o(que)
+);
+
+initial begin
+ $dumpfile("rv2insn_tb.vcd");
+ $dumpvars();
+ $readmemh("rv2insn.hex", rv);
+
+ clk = 0;
+ rst_n = 0;
+
+ #10 rst_n = 1;
+ #10 $finish;
+end
+endmodule