added v2.0
This commit is contained in:
31
01_Boolean_Logic/02_Buffer/Buffer_tb.gtkw
Normal file
31
01_Boolean_Logic/02_Buffer/Buffer_tb.gtkw
Normal file
@@ -0,0 +1,31 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Fri Nov 25 09:50:44 2022
|
||||
[*]
|
||||
[dumpfile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/0_Buffer/Buffer_tb.vcd"
|
||||
[dumpfile_mtime] "Fri Nov 25 09:50:10 2022"
|
||||
[dumpfile_size] 413
|
||||
[savefile] "/home/micha/gitlab/nand2tetris/01_Boolean_Logic/0_Buffer/Buffer_tb.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1000 600
|
||||
[pos] -1 -1
|
||||
*-0.034062 -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] 132
|
||||
@201
|
||||
-IN
|
||||
@28
|
||||
Buffer_tb.in
|
||||
@200
|
||||
-OUT
|
||||
@28
|
||||
Buffer_tb.out
|
||||
@200
|
||||
-CMP
|
||||
@28
|
||||
Buffer_tb.out_cmp
|
||||
Buffer_tb.fail
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
44
01_Boolean_Logic/02_Buffer/Buffer_tb.v
Normal file
44
01_Boolean_Logic/02_Buffer/Buffer_tb.v
Normal file
@@ -0,0 +1,44 @@
|
||||
`default_nettype none
|
||||
module Buffer_tb();
|
||||
|
||||
// IN,OUT
|
||||
reg in;
|
||||
wire out;
|
||||
|
||||
// Part
|
||||
Buffer BUFFER(
|
||||
.in(in),
|
||||
.out(out)
|
||||
);
|
||||
|
||||
// Compare
|
||||
wire out_cmp;
|
||||
assign out_cmp = in;
|
||||
|
||||
reg fail = 0;
|
||||
task check;
|
||||
#1
|
||||
if (out != out_cmp)
|
||||
begin
|
||||
$display("FAIL: in=%1b, out=%1b",in,out);
|
||||
fail=1;
|
||||
end
|
||||
endtask
|
||||
|
||||
// Test
|
||||
initial begin
|
||||
$dumpfile("Buffer_tb.vcd");
|
||||
$dumpvars(0, Buffer_tb);
|
||||
|
||||
$display("------------------------");
|
||||
$display("Testbench: Buffer");
|
||||
|
||||
in=0;check();
|
||||
in=1;check();
|
||||
|
||||
if (fail==0) $display("passed");
|
||||
$display("------------------------");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
3
01_Boolean_Logic/02_Buffer/Include.v
Normal file
3
01_Boolean_Logic/02_Buffer/Include.v
Normal file
@@ -0,0 +1,3 @@
|
||||
`include "../../01_Boolean_Logic/Nand.v"
|
||||
`include "../../01_Boolean_Logic/Not.v"
|
||||
`include "../../01_Boolean_Logic/Buffer.v"
|
3
01_Boolean_Logic/02_Buffer/apio.ini
Normal file
3
01_Boolean_Logic/02_Buffer/apio.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[env]
|
||||
board = iCE40-HX1K-EVB
|
||||
|
10
01_Boolean_Logic/02_Buffer/iCE40HX1K.pcf
Normal file
10
01_Boolean_Logic/02_Buffer/iCE40HX1K.pcf
Normal 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
|
||||
|
12
01_Boolean_Logic/02_Buffer/top.v
Normal file
12
01_Boolean_Logic/02_Buffer/top.v
Normal file
@@ -0,0 +1,12 @@
|
||||
`default_nettype none
|
||||
module top(
|
||||
input BUT1,
|
||||
input BUT2,
|
||||
output LED1,
|
||||
output LED2
|
||||
);
|
||||
|
||||
Buffer BUFFER1(.in(BUT1),.out(LED1));
|
||||
Buffer BUFFER2(.in(BUT2),.out(LED2));
|
||||
|
||||
endmodule
|
Reference in New Issue
Block a user