added v2.0
This commit is contained in:
35
01_Boolean_Logic/10_And16/And16_tb.gtkw
Normal file
35
01_Boolean_Logic/10_And16/And16_tb.gtkw
Normal file
@@ -0,0 +1,35 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Thu Dec 22 14:47:53 2022
|
||||
[*]
|
||||
[dumpfile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/09_And16/And16_tb.vcd"
|
||||
[dumpfile_mtime] "Thu Dec 22 14:47:31 2022"
|
||||
[dumpfile_size] 2339414
|
||||
[savefile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/09_And16/And16_tb.gtkw"
|
||||
[timestart] 5
|
||||
[size] 1000 600
|
||||
[pos] -1 -1
|
||||
*-2.000000 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[sst_width] 281
|
||||
[signals_width] 160
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 132
|
||||
@200
|
||||
-IN
|
||||
@22
|
||||
And16_tb.a[15:0]
|
||||
And16_tb.b[15:0]
|
||||
@200
|
||||
-OUT
|
||||
@22
|
||||
And16_tb.out[15:0]
|
||||
@200
|
||||
-CMP
|
||||
@23
|
||||
And16_tb.out_cmp[15:0]
|
||||
@200
|
||||
-Test
|
||||
@28
|
||||
And16_tb.fail
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
51
01_Boolean_Logic/10_And16/And16_tb.v
Normal file
51
01_Boolean_Logic/10_And16/And16_tb.v
Normal file
@@ -0,0 +1,51 @@
|
||||
`default_nettype none
|
||||
module And16_tb();
|
||||
|
||||
// IN,OUT
|
||||
reg [15:0] a,b;
|
||||
wire [15:0] out;
|
||||
|
||||
// Part
|
||||
And16 AND16(
|
||||
.a(a),
|
||||
.b(b),
|
||||
.out(out)
|
||||
);
|
||||
|
||||
// Compare
|
||||
wire [15:0] out_cmp;
|
||||
assign out_cmp = a&b;
|
||||
|
||||
reg fail = 0;
|
||||
reg [15:0] n = 0;
|
||||
task check;
|
||||
#1
|
||||
if (out != out_cmp)
|
||||
begin
|
||||
$display("FAIL: a=%16b, b=%16b, out=%16b",a,b,out);
|
||||
fail=1;
|
||||
end
|
||||
endtask
|
||||
|
||||
// Test
|
||||
initial begin
|
||||
$dumpfile("And16_tb.vcd");
|
||||
$dumpvars(0, And16_tb);
|
||||
|
||||
$display("------------------------");
|
||||
$display("Testbench: And16");
|
||||
|
||||
for (n=0; n<10000;n=n+1)
|
||||
begin
|
||||
a=$random;
|
||||
b=$random;
|
||||
check();
|
||||
|
||||
end
|
||||
|
||||
if (fail==0) $display("passed");
|
||||
$display("------------------------");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
11
01_Boolean_Logic/10_And16/Include.v
Normal file
11
01_Boolean_Logic/10_And16/Include.v
Normal file
@@ -0,0 +1,11 @@
|
||||
`include "../../01_Boolean_Logic/Nand.v"
|
||||
`include "../../01_Boolean_Logic/Not.v"
|
||||
`include "../../01_Boolean_Logic/Buffer.v"
|
||||
`include "../../01_Boolean_Logic/And.v"
|
||||
`include "../../01_Boolean_Logic/Or.v"
|
||||
`include "../../01_Boolean_Logic/Xor.v"
|
||||
`include "../../01_Boolean_Logic/Mux.v"
|
||||
`include "../../01_Boolean_Logic/DMux.v"
|
||||
`include "../../01_Boolean_Logic/Not16.v"
|
||||
`include "../../01_Boolean_Logic/Buffer16.v"
|
||||
`include "../../01_Boolean_Logic/And16.v"
|
3
01_Boolean_Logic/10_And16/apio.ini
Normal file
3
01_Boolean_Logic/10_And16/apio.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[env]
|
||||
board = iCE40-HX1K-EVB
|
||||
|
Reference in New Issue
Block a user