aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2
diff options
context:
space:
mode:
authormtnrbq <rmawston@live.com.au>2021-02-04 07:31:14 +1100
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commitb9eb443e549ab8c81e0c6bc94538f9f2fe2821d4 (patch)
tree97e409a03b546564b227900c1286407c299a4525 /machxo2
parent4948e8d914ec5d77777d197d7b2138cba933d33e (diff)
downloadnextpnr-b9eb443e549ab8c81e0c6bc94538f9f2fe2821d4.tar.gz
nextpnr-b9eb443e549ab8c81e0c6bc94538f9f2fe2821d4.tar.bz2
nextpnr-b9eb443e549ab8c81e0c6bc94538f9f2fe2821d4.zip
Add demo with RGB LED
Diffstat (limited to 'machxo2')
-rw-r--r--machxo2/examples/demorgb.sh10
-rw-r--r--machxo2/examples/rgbcount.v33
2 files changed, 43 insertions, 0 deletions
diff --git a/machxo2/examples/demorgb.sh b/machxo2/examples/demorgb.sh
new file mode 100644
index 00000000..f68db8c3
--- /dev/null
+++ b/machxo2/examples/demorgb.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ ! -z ${TRELLIS_DB+x} ]; then
+ DB_ARG="--db $TRELLIS_DB"
+fi
+
+${YOSYS:-yosys} -p 'synth_machxo2 -json rgbcount.json' rgbcount.v
+${NEXTPNR:-../../nextpnr-machxo2} --1200 --package QFN32 --no-iobs --json rgbcount.json --textcfg rgbcount.txt
+ecppack --compress $DB_ARG rgbcount.txt rgbcount.bit
+tinyproga -b rgbcount.bit
diff --git a/machxo2/examples/rgbcount.v b/machxo2/examples/rgbcount.v
new file mode 100644
index 00000000..230fc73c
--- /dev/null
+++ b/machxo2/examples/rgbcount.v
@@ -0,0 +1,33 @@
+// Modified from:
+// https://github.com/tinyfpga/TinyFPGA-A-Series/tree/master/template_a2
+// https://tinyfpga.com/a-series-guide.html used as a basis.
+
+module TinyFPGA_A2 (
+ (* LOC="21" *)
+ inout pin6,
+ (* LOC="26" *)
+ inout pin9_jtgnb,
+ (* LOC="27" *)
+ inout pin10_sda,
+);
+ wire clk;
+
+ OSCH #(
+ .NOM_FREQ("2.08")
+ ) internal_oscillator_inst (
+ .STDBY(1'b0),
+ .OSC(clk)
+ );
+
+ reg [23:0] led_timer;
+
+ always @(posedge clk) begin
+ led_timer <= led_timer + 1;
+ end
+
+ // left side of board
+ assign pin9_jtgnb = led_timer[23];
+ assign pin10_sda = led_timer[22];
+ assign pin6 = led_timer[21];
+
+endmodule \ No newline at end of file