From 373edb42380875eafc8b9de54d80b939d263d041 Mon Sep 17 00:00:00 2001
From: Kimplul <kimi.h.kuparinen@gmail.com>
Date: Sun, 16 Feb 2025 22:36:57 +0200
Subject: add some kind of toplevel

---
 tb/ttarv32_tb.sv | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 tb/ttarv32_tb.sv

(limited to 'tb/ttarv32_tb.sv')

diff --git a/tb/ttarv32_tb.sv b/tb/ttarv32_tb.sv
new file mode 100644
index 0000000..6277f02
--- /dev/null
+++ b/tb/ttarv32_tb.sv
@@ -0,0 +1,45 @@
+`include "common.svh"
+
+module ttarv32_tb;
+
+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
+
+xlen_t pc;
+logic[7:0] rv[4*4];
+
+logic clk;
+logic rst_n;
+
+ttarv32 #(
+	.SLOT_COUNT(4),
+	.SLOT_DEPTH(3),
+	.ALU_COUNT(2)
+) ttarv32 (
+	.clk_i(clk),
+	.rst_ni(rst_n),
+	.rv_i(unp2p(rv)),
+	.pc_o(pc)
+);
+
+initial begin
+	$dumpfile("ttarv32_tb.vcd");
+	$dumpvars();
+	$readmemh("ttarv32.hex", rv);
+
+	clk = 0;
+	rst_n = 0;
+
+	#10 rst_n = 1;
+	clk = 1;
+
+	#10
+	$finish;
+end
+
+endmodule
-- 
cgit v1.2.3