Skip to content

Commit 4539155

Browse files
committed
TinyFPGA-BX: Blinky example added
1 parent 65929f4 commit 4539155

4 files changed

Lines changed: 123 additions & 0 deletions

File tree

TinyFPGA-BX/Blinky/Blinky.v

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//------------------------------------------------------------------
2+
//-- Blinking LED
3+
//------------------------------------------------------------------
4+
5+
module Test (
6+
input CLK, // 16MHz clock
7+
output LED, // User/boot LED next to power LED
8+
output USBPU // USB pull-up resistor
9+
);
10+
11+
// drive USB pull-up resistor to '0' to disable USB
12+
assign USBPU = 0;
13+
14+
reg [24:0] counter = 0;
15+
16+
always @(posedge CLK)
17+
counter <= counter + 1;
18+
19+
assign LED = counter[24];
20+
21+
endmodule
22+
23+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
###############################################################################
2+
#
3+
# TinyFPGA BX constraint file (.pcf)
4+
#
5+
###############################################################################
6+
#
7+
# Copyright (c) 2018, Luke Valenty
8+
# All rights reserved.
9+
#
10+
# Redistribution and use in source and binary forms, with or without
11+
# modification, are permitted provided that the following conditions are met:
12+
#
13+
# 1. Redistributions of source code must retain the above copyright notice, this
14+
# list of conditions and the following disclaimer.
15+
# 2. Redistributions in binary form must reproduce the above copyright notice,
16+
# this list of conditions and the following disclaimer in the documentation
17+
# and/or other materials provided with the distribution.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23+
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
#
30+
# The views and conclusions contained in the software and documentation are those
31+
# of the authors and should not be interpreted as representing official policies,
32+
# either expressed or implied, of the <project name> project.
33+
#
34+
###############################################################################
35+
36+
####
37+
# TinyFPGA BX information: https://github.com/tinyfpga/TinyFPGA-BX/
38+
####
39+
40+
# Left side of board
41+
set_io --warn-no-port PIN_1 A2
42+
set_io --warn-no-port PIN_2 A1
43+
set_io --warn-no-port PIN_3 B1
44+
set_io --warn-no-port PIN_4 C2
45+
set_io --warn-no-port PIN_5 C1
46+
set_io --warn-no-port PIN_6 D2
47+
set_io --warn-no-port PIN_7 D1
48+
set_io --warn-no-port PIN_8 E2
49+
set_io --warn-no-port PIN_9 E1
50+
set_io --warn-no-port PIN_10 G2
51+
set_io --warn-no-port PIN_11 H1
52+
set_io --warn-no-port PIN_12 J1
53+
set_io --warn-no-port PIN_13 H2
54+
55+
# Right side of board
56+
set_io --warn-no-port PIN_14 H9
57+
set_io --warn-no-port PIN_15 D9
58+
set_io --warn-no-port PIN_16 D8
59+
set_io --warn-no-port PIN_17 C9
60+
set_io --warn-no-port PIN_18 A9
61+
set_io --warn-no-port PIN_19 B8
62+
set_io --warn-no-port PIN_20 A8
63+
set_io --warn-no-port PIN_21 B7
64+
set_io --warn-no-port PIN_22 A7
65+
set_io --warn-no-port PIN_23 B6
66+
set_io --warn-no-port PIN_24 A6
67+
68+
# SPI flash interface on bottom of board
69+
set_io --warn-no-port SPI_SS F7
70+
set_io --warn-no-port SPI_SCK G7
71+
set_io --warn-no-port SPI_IO0 G6
72+
set_io --warn-no-port SPI_IO1 H7
73+
set_io --warn-no-port SPI_IO2 H4
74+
set_io --warn-no-port SPI_IO3 J8
75+
76+
# General purpose pins on bottom of board
77+
set_io --warn-no-port PIN_25 G1
78+
set_io --warn-no-port PIN_26 J3
79+
set_io --warn-no-port PIN_27 J4
80+
set_io --warn-no-port PIN_28 G9
81+
set_io --warn-no-port PIN_29 J9
82+
set_io --warn-no-port PIN_30 E8
83+
set_io --warn-no-port PIN_31 J2
84+
85+
# LED
86+
set_io --warn-no-port LED B3
87+
88+
# USB
89+
set_io --warn-no-port USBP B4
90+
set_io --warn-no-port USBN A4
91+
set_io --warn-no-port USBPU A3
92+
93+
# 16MHz clock
94+
set_io --warn-no-port CLK B2 # input

TinyFPGA-BX/Blinky/apio.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[env]
2+
board = TinyFPGA-BX
3+

TinyFPGA-BX/Blinky/info

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Blinking LED for the TinyFPGA
2+
3+

0 commit comments

Comments
 (0)