Merge branch 'main' of https://github.com/erickahmed/square-one
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
'include "cpu/alu/adder.sv"
|
||||
|
||||
module adder_tb();
|
||||
reg ta,tb, tc;
|
||||
wire t_sum, t_carry;
|
||||
adder dut(t_sum, t_carry, ta, tb, tc);
|
||||
initial begin
|
||||
ta = 0; tb = 0; tc = 0;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 0; tc = 0;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 0; tb = 1; tc = 0;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 1; tc = 0;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 0; tb = 0; tc = 1;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 0; tc = 1;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 0; tb = 1; tc = 1;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 1; tc = 1;
|
||||
$monitor("A/B/C: %b, %b, %b ",ta, tb, tc, "S/C: %b, %b",t_sum, t_carry);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,18 +0,0 @@
|
||||
'include "predefined/and16.v"
|
||||
|
||||
module and16_tb();
|
||||
reg [15:0]ta;
|
||||
reg [15:0]tb;
|
||||
wire [15:0]y;
|
||||
and16 dut(y, ta, tb);
|
||||
initial begin
|
||||
ta = 15'b000000000000000; tb = 15'b000000000000000;
|
||||
$monitor("IN: %b, %b ", ta, tb, "OUT: ", y);
|
||||
#5 ta = 15'b011010010110010; tb = 15'b000000000000000;
|
||||
$monitor("IN: %b, %b ", ta, tb, "OUT: ", y);
|
||||
#5 ta = 15'b000000000000000; tb = 15'b100010110101110;
|
||||
$monitor("IN: %b, %b ", ta, tb, "OUT: ", y);
|
||||
#5 ta = 15'b111111111111111; tb = 15'b111111111111111;
|
||||
$monitor("IN: %b, %b ", ta, tb, "OUT: ", y);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,17 +0,0 @@
|
||||
'include "predefined/and_gate.v"
|
||||
|
||||
module and_tb();
|
||||
reg ta,tb;
|
||||
wire ty;
|
||||
and_gate dut(y, ta, tb);
|
||||
initial begin
|
||||
ta = 0; tb = 0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 1; tb = 0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 0; tb = 1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 1; tb = 1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,20 +0,0 @@
|
||||
'include "predefined/demux.v"
|
||||
|
||||
module demux_tb();
|
||||
reg a,b, sel;
|
||||
output y;
|
||||
demux dut(y, z, a, sel);
|
||||
initial begin
|
||||
a = 0; sel = 0;
|
||||
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
|
||||
#5;
|
||||
a = 1;sel = 0;
|
||||
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
|
||||
#5;
|
||||
a = 0; sel = 1;
|
||||
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
|
||||
#5;
|
||||
a = 1; sel = 1;
|
||||
$monitor("IN: %b ",a, "SEL: ",sel, " OUT: a: %b, b: %b", y, z);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,17 +0,0 @@
|
||||
'include "cpu/alu/halfadder.sv"
|
||||
|
||||
module halfadder_tb();
|
||||
reg ta,tb;
|
||||
wire t_sum, t_carry;
|
||||
halfadder dut(t_sum, t_carry, ta, tb);
|
||||
initial begin
|
||||
ta = 0; tb = 0;
|
||||
$monitor("A/B: %b, %b ",ta, tb, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 0;
|
||||
$monitor("A/B: %b, %b ",ta, tb, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 0; tb = 1;
|
||||
$monitor("A/B: %b, %b ",ta, tb, "S/C: %b, %b",t_sum, t_carry);
|
||||
#5 ta = 1; tb = 1;
|
||||
$monitor("A/B: %b, %b ",ta, tb, "S/C: %b, %b",t_sum, t_carry);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,32 +0,0 @@
|
||||
'include "predefined/mux.v"
|
||||
|
||||
module mux_tb();
|
||||
reg a,b, sel;
|
||||
output y;
|
||||
mux dut(a, b, sel, y);
|
||||
initial begin
|
||||
a = 0; b = 0; sel = 0;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 1; b = 0; sel = 0;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 0; b = 1; sel = 0;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 1; b = 1; sel = 0;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 0; b = 0; sel = 1;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 1; b = 0; sel = 1;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 0; b = 1; sel = 1;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
#5;
|
||||
a = 1; b = 1; sel = 1;
|
||||
$monitor("IN: %b, %b ",a, b, "SEL: ",sel, " OUT: ",y);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,17 +0,0 @@
|
||||
'include "predefined/nand_gate.v"
|
||||
|
||||
module nand_tb();
|
||||
reg ta,tb;
|
||||
wire ty;
|
||||
nand_gate dut(y, ta, tb);
|
||||
initial begin
|
||||
ta = 0; tb = 0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 1; tb = 0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 0; tb = 1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
#5 ta = 1; tb = 1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
end
|
||||
endmodule
|
||||
@@ -1,18 +0,0 @@
|
||||
'include "predefined/nor_gate.v"
|
||||
|
||||
module nor_tb();
|
||||
reg ta, tb;
|
||||
wire ty;
|
||||
|
||||
nor_gate dut(y, ta, tb);
|
||||
|
||||
initial begin
|
||||
ta=0, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=0, tb=1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=1;
|
||||
end
|
||||
endmodule
|
||||
@@ -1,15 +0,0 @@
|
||||
'include "predefined/not_gate.v"
|
||||
|
||||
module not_tb();
|
||||
reg ta;
|
||||
wire ty;
|
||||
|
||||
not_gate dut(y, ta);
|
||||
|
||||
initial begin
|
||||
ta=0;
|
||||
$monitor("IN: %b", ta, "OUT: ", y)
|
||||
ta=1;
|
||||
$monitor("IN: %b", ta, "OUT: ", y)
|
||||
end
|
||||
endmodule
|
||||
@@ -1,18 +0,0 @@
|
||||
'include "predefined/or_gate.v"
|
||||
|
||||
module or_tb();
|
||||
reg ta, tb;
|
||||
wire ty;
|
||||
|
||||
or_gate dut(y, ta, tb);
|
||||
|
||||
initial begin
|
||||
ta=0, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=0, tb=1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=1;
|
||||
end
|
||||
endmodule
|
||||
@@ -1,18 +0,0 @@
|
||||
'include "predefined/xnor_gate.v"
|
||||
|
||||
module xnor_tb();
|
||||
reg ta, tb;
|
||||
wire ty;
|
||||
|
||||
xnor_gate dut(y, ta, tb);
|
||||
|
||||
initial begin
|
||||
ta=0, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=0, tb=1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=1;
|
||||
end
|
||||
endmodule
|
||||
@@ -1,18 +0,0 @@
|
||||
'include "predefined/xor_gate.v"
|
||||
|
||||
module nor_tb();
|
||||
reg ta, tb;
|
||||
wire ty;
|
||||
|
||||
xor_gate dut(y, ta, tb);
|
||||
|
||||
initial begin
|
||||
ta=0, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=0, tb=1;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=0;
|
||||
$monitor("IN: %b, %b ",ta, tb, "OUT: ",y);
|
||||
ta=1, tb=1;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user