aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/examples/rgbcount.v
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-02-15 09:39:56 +0000
committerGitHub <noreply@github.com>2021-02-15 09:39:56 +0000
commit065f46daeb05a8b12cc663a44410b6da27a8d9e3 (patch)
treeca538791141e442c105c47f836069f95ce2f988d /machxo2/examples/rgbcount.v
parent1b6cdce9251d42236a3db0314e84d6a3e3f06408 (diff)
parent9c9a02628d60dca9c9a566b0fcf3bf3dd2c68076 (diff)
downloadnextpnr-065f46daeb05a8b12cc663a44410b6da27a8d9e3.tar.gz
nextpnr-065f46daeb05a8b12cc663a44410b6da27a8d9e3.tar.bz2
nextpnr-065f46daeb05a8b12cc663a44410b6da27a8d9e3.zip
Merge pull request #578 from YosysHQ/machxo2-rebase
machxo2, rebased and updated
Diffstat (limited to 'machxo2/examples/rgbcount.v')
-rw-r--r--machxo2/examples/rgbcount.v33
1 files changed, 33 insertions, 0 deletions
diff --git a/machxo2/examples/rgbcount.v b/machxo2/examples/rgbcount.v
new file mode 100644
index 00000000..bf5c7518
--- /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 top (
+ (* 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