added v2.0

This commit is contained in:
Michael Schröder
2023-01-11 11:13:09 +01:00
parent 2a5a64ca91
commit 971b323822
584 changed files with 159319 additions and 0 deletions

View File

@@ -0,0 +1 @@
`include "../../01_Boolean_Logic/Nand.v"

View File

@@ -0,0 +1,32 @@
[*]
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
[*] Thu Dec 22 14:24:30 2022
[*]
[dumpfile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/00_Nand/Nand_tb.vcd"
[dumpfile_mtime] "Thu Dec 22 14:23:51 2022"
[dumpfile_size] 466
[savefile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/00_Nand/Nand_tb.gtkw"
[timestart] 0
[size] 1348 589
[pos] -1 -1
*-0.771027 -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 -1
[sst_width] 281
[signals_width] 100
[sst_expanded] 1
[sst_vpaned_height] 129
@200
-IN
@28
Nand_tb.a
Nand_tb.b
@200
-OUT
@28
Nand_tb.out
@200
-CMP
@28
Nand_tb.out_cmp
Nand_tb.fail
[pattern_trace] 1
[pattern_trace] 0

View File

@@ -0,0 +1,47 @@
`default_nettype none
module Nand_tb();
// IN,OUT
reg a,b;
wire out;
// Part
Nand NAND(
.a(a),
.b(b),
.out(out)
);
// Compare
wire out_cmp;
assign out_cmp = ~(a&b);
reg fail = 0;
task check;
#1
if (out != out_cmp)
begin
$display("FAIL: a=%1b, b=%1b, out=%1b",a,b,out);
fail=1;
end
endtask
// Test
initial begin
$dumpfile("Nand_tb.vcd");
$dumpvars(0, Nand_tb);
$display("------------------------");
$display("Testbench: Nand");
a=0;b=0;check();
a=0;b=1;check();
a=1;b=0;check();
a=1;b=1;check();
if (fail==0) $display("passed");
$display("------------------------");
$finish;
end
endmodule

View File

@@ -0,0 +1,3 @@
[env]
board = iCE40-HX1K-EVB

View File

@@ -0,0 +1,10 @@
# physical constrain file
# assign io-pins to pin numbering of iCE40-HX1K on olimex board iCE40-HX1K-EVB
# compare to the schematic of the board and the datasheet of fpga
set_io BUT1 41 # BUT1
set_io BUT2 42 # BUT2
set_io LED1 40 # LED1
set_io LED2 51 # LED2

View File

@@ -0,0 +1,11 @@
`default_nettype none
module top(
input BUT1,
input BUT2,
output LED1,
output LED2
);
Nand NAND(.a(BUT1),.b(BUT2),.out(LED1));
endmodule