From 6c1db8cded8b8bb1c4d31a840f7dd9dddb8bbf7d Mon Sep 17 00:00:00 2001 From: uvok Date: Fri, 2 Jan 2026 19:36:30 +0100 Subject: Rename variables to be more clear, document --- nandgame/logic_unit_tb.sv | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'nandgame/logic_unit_tb.sv') diff --git a/nandgame/logic_unit_tb.sv b/nandgame/logic_unit_tb.sv index 3f50ce2..95211c1 100644 --- a/nandgame/logic_unit_tb.sv +++ b/nandgame/logic_unit_tb.sv @@ -4,16 +4,15 @@ module logic_unit_tb; -logic [15:0] in1; -logic [15:0] in2; -LogicCode opcode; -logic [15:0] result; +logic [15:0] tst_in1, tst_in2; +LogicCode tst_opcode; +logic [15:0] tst_result; logic_unit uut ( - .X(in1), - .Y(in2), - .operation(opcode), - .RES(result) + .X_in(tst_in1), + .Y_in(tst_in2), + .logic_operation_in(tst_opcode), + .result_out(tst_result) ); string filename; @@ -28,28 +27,28 @@ initial begin end initial begin - in1 = 16'b1010; - in2 = 16'b1100; - opcode = LOGIC_AND; + tst_in1 = 16'b1010; + tst_in2 = 16'b1100; + tst_opcode = LOGIC_AND; #1 - assert(result == 16'b1000); + assert(tst_result == 16'b1000); #1 - in1 = 16'b1010; - in2 = 16'b1100; - opcode = LOGIC_OR; + tst_in1 = 16'b1010; + tst_in2 = 16'b1100; + tst_opcode = LOGIC_OR; #1 - assert(result == 16'b1110); + assert(tst_result == 16'b1110); #1 - in1 = 16'b1010; - in2 = 16'b1100; - opcode = LOGIC_XOR; + tst_in1 = 16'b1010; + tst_in2 = 16'b1100; + tst_opcode = LOGIC_XOR; #1 - assert(result == 16'b0110); + assert(tst_result == 16'b0110); #1 - in1 = 16'b1010101010101010; - opcode = LOGIC_NEGT; + tst_in1 = 16'b1010101010101010; + tst_opcode = LOGIC_NEGT; #1 - assert(result == 16'b0101010101010101); + assert(tst_result == 16'b0101010101010101); #1 $finish(); end -- cgit v1.2.3