Skip to content

Commit 375974b

Browse files
committed
Add example ledon for the Basys3 board (Xilinx FPGA)
1 parent 8041a9d commit 375974b

6 files changed

Lines changed: 174 additions & 0 deletions

File tree

examples/basys3/ledon/apio.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; Apio project configuration file.
2+
; See https://fpgawars.github.io/apio/docs/project-file for details.
3+
4+
[env:default]
5+
board = basys3
6+
top-module = ledon

examples/basys3/ledon/basys3.xdc

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
2+
#-- Placa Basys3
3+
4+
#-- Reloj del sistema
5+
set_property -dict { PACKAGE_PIN W5 IOSTANDARD LVCMOS33 } [get_ports {clk}]
6+
7+
#-- LEDs
8+
set_property -dict { PACKAGE_PIN U16 IOSTANDARD LVCMOS33 } [get_ports {leds[0]}]
9+
set_property -dict { PACKAGE_PIN E19 IOSTANDARD LVCMOS33 } [get_ports {leds[1]}]
10+
set_property -dict { PACKAGE_PIN U19 IOSTANDARD LVCMOS33 } [get_ports {leds[2]}]
11+
set_property -dict { PACKAGE_PIN V19 IOSTANDARD LVCMOS33 } [get_ports {leds[3]}]
12+
set_property -dict { PACKAGE_PIN W18 IOSTANDARD LVCMOS33 } [get_ports {leds[4]}]
13+
set_property -dict { PACKAGE_PIN U15 IOSTANDARD LVCMOS33 } [get_ports {leds[5]}]
14+
set_property -dict { PACKAGE_PIN U14 IOSTANDARD LVCMOS33 } [get_ports {leds[6]}]
15+
set_property -dict { PACKAGE_PIN V14 IOSTANDARD LVCMOS33 } [get_ports {leds[7]}]
16+
set_property -dict { PACKAGE_PIN V13 IOSTANDARD LVCMOS33 } [get_ports {leds[8]}]
17+
set_property -dict { PACKAGE_PIN V3 IOSTANDARD LVCMOS33 } [get_ports {leds[9]}]
18+
set_property -dict { PACKAGE_PIN W3 IOSTANDARD LVCMOS33 } [get_ports {leds[10]}]
19+
set_property -dict { PACKAGE_PIN U3 IOSTANDARD LVCMOS33 } [get_ports {leds[11]}]
20+
set_property -dict { PACKAGE_PIN P3 IOSTANDARD LVCMOS33 } [get_ports {leds[12]}]
21+
set_property -dict { PACKAGE_PIN N3 IOSTANDARD LVCMOS33 } [get_ports {leds[13]}]
22+
set_property -dict { PACKAGE_PIN P1 IOSTANDARD LVCMOS33 } [get_ports {leds[14]}]
23+
set_property -dict { PACKAGE_PIN L1 IOSTANDARD LVCMOS33 } [get_ports {leds[15]}]
24+
25+
#------------- Botones
26+
#-- Centro
27+
set_property -dict { PACKAGE_PIN U18 IOSTANDARD LVCMOS33 } [get_ports {buttons[0]}]
28+
29+
#-- Arriba
30+
set_property -dict { PACKAGE_PIN T18 IOSTANDARD LVCMOS33 } [get_ports {buttons[1]}]
31+
32+
#-- Izquierda
33+
set_property -dict { PACKAGE_PIN W19 IOSTANDARD LVCMOS33 } [get_ports {buttons[2]}]
34+
35+
#-- Derecha
36+
set_property -dict { PACKAGE_PIN T17 IOSTANDARD LVCMOS33 } [get_ports {buttons[3]}]
37+
38+
#-- Abajo
39+
set_property -dict { PACKAGE_PIN U17 IOSTANDARD LVCMOS33 } [get_ports {buttons[4]}]
40+
41+
#------------ Switches
42+
set_property -dict { PACKAGE_PIN V17 IOSTANDARD LVCMOS33 } [get_ports {switches[0]}]
43+
set_property -dict { PACKAGE_PIN V16 IOSTANDARD LVCMOS33 } [get_ports {switches[1]}]
44+
set_property -dict { PACKAGE_PIN W17 IOSTANDARD LVCMOS33 } [get_ports {switches[2]}]
45+
set_property -dict { PACKAGE_PIN W16 IOSTANDARD LVCMOS33 } [get_ports {switches[3]}]
46+
set_property -dict { PACKAGE_PIN W15 IOSTANDARD LVCMOS33 } [get_ports {switches[4]}]
47+
set_property -dict { PACKAGE_PIN V15 IOSTANDARD LVCMOS33 } [get_ports {switches[5]}]
48+
set_property -dict { PACKAGE_PIN W14 IOSTANDARD LVCMOS33 } [get_ports {switches[6]}]
49+
set_property -dict { PACKAGE_PIN W13 IOSTANDARD LVCMOS33 } [get_ports {switches[7]}]
50+
set_property -dict { PACKAGE_PIN V2 IOSTANDARD LVCMOS33 } [get_ports {switches[8]}]
51+
set_property -dict { PACKAGE_PIN T3 IOSTANDARD LVCMOS33 } [get_ports {switches[9]}]
52+
set_property -dict { PACKAGE_PIN T2 IOSTANDARD LVCMOS33 } [get_ports {switches[10]}]
53+
set_property -dict { PACKAGE_PIN R3 IOSTANDARD LVCMOS33 } [get_ports {switches[11]}]
54+
set_property -dict { PACKAGE_PIN W2 IOSTANDARD LVCMOS33 } [get_ports {switches[12]}]
55+
set_property -dict { PACKAGE_PIN U1 IOSTANDARD LVCMOS33 } [get_ports {switches[13]}]
56+
set_property -dict { PACKAGE_PIN T1 IOSTANDARD LVCMOS33 } [get_ports {switches[14]}]
57+
set_property -dict { PACKAGE_PIN R2 IOSTANDARD LVCMOS33 } [get_ports {switches[15]}]
58+
59+
#------------ Displays de 7 segmentos
60+
61+
#-- Seleccion del display donde mostrar los segmentos
62+
set_property -dict { PACKAGE_PIN U2 IOSTANDARD LVCMOS33 } [get_ports {display_sel[0]}]
63+
set_property -dict { PACKAGE_PIN U4 IOSTANDARD LVCMOS33 } [get_ports {display_sel[1]}]
64+
set_property -dict { PACKAGE_PIN V4 IOSTANDARD LVCMOS33 } [get_ports {display_sel[2]}]
65+
set_property -dict { PACKAGE_PIN W4 IOSTANDARD LVCMOS33 } [get_ports {display_sel[3]}]
66+
67+
#-- Segmentos de los displays
68+
set_property -dict { PACKAGE_PIN W7 IOSTANDARD LVCMOS33 } [get_ports {segments[0]}]
69+
set_property -dict { PACKAGE_PIN W6 IOSTANDARD LVCMOS33 } [get_ports {segments[1]}]
70+
set_property -dict { PACKAGE_PIN U8 IOSTANDARD LVCMOS33 } [get_ports {segments[2]}]
71+
set_property -dict { PACKAGE_PIN V8 IOSTANDARD LVCMOS33 } [get_ports {segments[3]}]
72+
set_property -dict { PACKAGE_PIN U5 IOSTANDARD LVCMOS33 } [get_ports {segments[4]}]
73+
set_property -dict { PACKAGE_PIN V5 IOSTANDARD LVCMOS33 } [get_ports {segments[5]}]
74+
set_property -dict { PACKAGE_PIN U7 IOSTANDARD LVCMOS33 } [get_ports {segments[6]}]
75+
set_property -dict { PACKAGE_PIN V7 IOSTANDARD LVCMOS33 } [get_ports {segments[7]}]
76+
77+
78+
#--------- VGA
79+
set_property -dict { PACKAGE_PIN G19 IOSTANDARD LVCMOS33 } [get_ports {vga_red[0]}]
80+
set_property -dict { PACKAGE_PIN H19 IOSTANDARD LVCMOS33 } [get_ports {vga_red[1]}]
81+
set_property -dict { PACKAGE_PIN J19 IOSTANDARD LVCMOS33 } [get_ports {vga_red[2]}]
82+
set_property -dict { PACKAGE_PIN N19 IOSTANDARD LVCMOS33 } [get_ports {vga_red[3]}]
83+
set_property -dict { PACKAGE_PIN N18 IOSTANDARD LVCMOS33 } [get_ports {vga_blue[0]}]
84+
set_property -dict { PACKAGE_PIN L18 IOSTANDARD LVCMOS33 } [get_ports {vga_blue[1]}]
85+
set_property -dict { PACKAGE_PIN K18 IOSTANDARD LVCMOS33 } [get_ports {vga_blue[2]}]
86+
set_property -dict { PACKAGE_PIN J18 IOSTANDARD LVCMOS33 } [get_ports {vga_blue[3]}]
87+
set_property -dict { PACKAGE_PIN J17 IOSTANDARD LVCMOS33 } [get_ports {vga_green[0]}]
88+
set_property -dict { PACKAGE_PIN H17 IOSTANDARD LVCMOS33 } [get_ports {vga_green[1]}]
89+
set_property -dict { PACKAGE_PIN G17 IOSTANDARD LVCMOS33 } [get_ports {vga_green[2]}]
90+
set_property -dict { PACKAGE_PIN D17 IOSTANDARD LVCMOS33 } [get_ports {vga_green[3]}]
91+
set_property -dict { PACKAGE_PIN P19 IOSTANDARD LVCMOS33 } [get_ports {vga_hsync}]
92+
set_property -dict { PACKAGE_PIN R19 IOSTANDARD LVCMOS33 } [get_ports {vga_vsync}]
93+
94+
95+
#--- UART
96+
set_property -dict { PACKAGE_PIN B18 IOSTANDARD LVCMOS33 } [get_ports {uart_rx_async}]
97+
set_property -dict { PACKAGE_PIN A18 IOSTANDARD LVCMOS33 } [get_ports {uart_tx}]

examples/basys3/ledon/info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Turning on a led

examples/basys3/ledon/ledon.v

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
`default_nettype none
2+
3+
//-- Ejemplo basico para encender un led
4+
module ledon (
5+
6+
//-- LEDs de la BASYS3
7+
output wire [15:0] leds
8+
);
9+
10+
//-- Encender led15!
11+
assign leds[15] = 1'b1;
12+
13+
endmodule
14+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[*]
2+
[*] GTKWave Analyzer v3.4.0 (w)1999-2022 BSI
3+
[*] Sat Jun 6 18:41:25 2026
4+
[*]
5+
[dumpfile] "/home/obijuan/Develop/FPGAwars/apio/ledon/_build/default/ledon_tb.vcd"
6+
[dumpfile_mtime] "Sat Jun 6 18:40:47 2026"
7+
[dumpfile_size] 441
8+
[savefile] "/home/obijuan/Develop/FPGAwars/apio/ledon/ledon_tb.gtkw"
9+
[timestart] 0
10+
[size] 1000 600
11+
[pos] -1 -1
12+
*-8.389495 146000 -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
13+
[treeopen] ledon_tb.
14+
[sst_width] 297
15+
[signals_width] 129
16+
[sst_expanded] 1
17+
[sst_vpaned_height] 144
18+
@28
19+
ledon_tb.led15
20+
[pattern_trace] 1
21+
[pattern_trace] 0

examples/basys3/ledon/ledon_tb.v

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//-------------------------------------------------------------------
2+
//-- ledon_tb.v
3+
//-- Testbench
4+
//-------------------------------------------------------------------
5+
//-- Juan Gonzalez (Obijuan)
6+
//-- GPL license
7+
//-------------------------------------------------------------------
8+
`default_nettype none `timescale 100 ns / 10 ns
9+
10+
module ledon_tb ();
11+
12+
//-- Simulation time: 1us (10 * 100ns)
13+
parameter DURATION = 10;
14+
15+
//-- Leds port
16+
wire [15:0] leds;
17+
18+
wire led15 = leds[15];
19+
20+
//-- Instantiate the unit to test
21+
ledon UUT (
22+
.leds(leds)
23+
);
24+
25+
26+
initial begin
27+
28+
//-- Dump vars to the .vcd output file
29+
$dumpvars(0, ledon_tb);
30+
31+
#(DURATION) $display("End of simulation");
32+
$finish;
33+
end
34+
35+
endmodule

0 commit comments

Comments
 (0)