Add counter test.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
c65ba121e0
commit
9cbfd0b967
8
fpga_interchange/examples/counter/Makefile
Normal file
8
fpga_interchange/examples/counter/Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
DESIGN := counter
|
||||
DESIGN_TOP := top
|
||||
PACKAGE := cpg236
|
||||
|
||||
include ../template.mk
|
||||
|
||||
build/counter.json: counter.v | build
|
||||
yosys -c run.tcl
|
15
fpga_interchange/examples/counter/counter.v
Normal file
15
fpga_interchange/examples/counter/counter.v
Normal file
@ -0,0 +1,15 @@
|
||||
module top(input clk, input rst, output [7:4] io_led);
|
||||
|
||||
reg [31:0] counter = 32'b0;
|
||||
|
||||
assign io_led = counter >> 22;
|
||||
|
||||
always @(posedge clk)
|
||||
begin
|
||||
if(rst)
|
||||
counter <= 32'b0;
|
||||
else
|
||||
counter <= counter + 1;
|
||||
end
|
||||
|
||||
endmodule
|
22
fpga_interchange/examples/counter/counter.xdc
Normal file
22
fpga_interchange/examples/counter/counter.xdc
Normal file
@ -0,0 +1,22 @@
|
||||
## basys3 breakout board
|
||||
set_property PACKAGE_PIN W5 [get_ports clk]
|
||||
set_property PACKAGE_PIN V17 [get_ports rst]
|
||||
#set_property PACKAGE_PIN U16 [get_ports io_led[0]]
|
||||
#set_property PACKAGE_PIN E19 [get_ports io_led[1]]
|
||||
#set_property PACKAGE_PIN U19 [get_ports io_led[2]]
|
||||
#set_property PACKAGE_PIN V19 [get_ports io_led[3]]
|
||||
set_property PACKAGE_PIN U16 [get_ports io_led[4]]
|
||||
set_property PACKAGE_PIN E19 [get_ports io_led[5]]
|
||||
set_property PACKAGE_PIN U19 [get_ports io_led[6]]
|
||||
set_property PACKAGE_PIN V19 [get_ports io_led[7]]
|
||||
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports clk]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports rst]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports io_led[4]]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports io_led[5]]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports io_led[6]]
|
||||
set_property IOSTANDARD LVCMOS33 [get_ports io_led[7]]
|
||||
#set_property IOSTANDARD LVCMOS33 [get_ports io_led[0]]
|
||||
#set_property IOSTANDARD LVCMOS33 [get_ports io_led[1]]
|
||||
#set_property IOSTANDARD LVCMOS33 [get_ports io_led[2]]
|
||||
#set_property IOSTANDARD LVCMOS33 [get_ports io_led[3]]
|
15
fpga_interchange/examples/counter/run.tcl
Normal file
15
fpga_interchange/examples/counter/run.tcl
Normal file
@ -0,0 +1,15 @@
|
||||
yosys -import
|
||||
|
||||
read_verilog counter.v
|
||||
|
||||
synth_xilinx -nolutram -nowidelut -nosrl -nocarry -nodsp
|
||||
techmap -map ../remap.v
|
||||
|
||||
# opt_expr -undriven makes sure all nets are driven, if only by the $undef
|
||||
# net.
|
||||
opt_expr -undriven
|
||||
opt_clean
|
||||
|
||||
setundef -zero -params
|
||||
|
||||
write_json build/counter.json
|
11
fpga_interchange/examples/remap.v
Normal file
11
fpga_interchange/examples/remap.v
Normal file
@ -0,0 +1,11 @@
|
||||
module INV(input I, output O);
|
||||
|
||||
LUT1 #(.INIT(2'b01)) _TECHMAP_REPLACE_ (.I0(I), .O(O));
|
||||
|
||||
endmodule
|
||||
|
||||
module BUF(input I, output O);
|
||||
|
||||
LUT1 #(.INIT(2'b10)) _TECHMAP_REPLACE_ (.I0(I), .O(O));
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user