From 01f9d96173adb501e5e488b1d726574f98338ea7 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 15 Mar 2023 14:04:37 -0400 Subject: [PATCH] Add LED example Add a small LED example to let me test the blinker functionality. Signed-off-by: Sean Anderson --- examples/README.adoc | 1 + examples/led/README.adoc | 11 ++++++++++ examples/led/top.pcf | 5 +++++ examples/led/top.v | 44 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 examples/led/README.adoc create mode 100644 examples/led/top.pcf create mode 100644 examples/led/top.v diff --git a/examples/README.adoc b/examples/README.adoc index 1de2fa5..a2b7b02 100644 --- a/examples/README.adoc +++ b/examples/README.adoc @@ -6,3 +6,4 @@ cores in this project. :leveloffset: +1 include::breakout_hub/README.adoc[] +include::led/README.adoc[] diff --git a/examples/led/README.adoc b/examples/led/README.adoc new file mode 100644 index 0000000..03e977c --- /dev/null +++ b/examples/led/README.adoc @@ -0,0 +1,11 @@ += LED Blinker test + +This directory contains an example design to test the LED blinkers. It runs on an +https://www.olimex.com/Products/FPGA/iCE40/iCE40HX8K-EVB/[Olimex iCE40HX8K-EVB]. +Pushing the buttons will cause the LEDs to blink at 30 Hz. + +To compile this design, run + + $ make examples/led/top.bin + +from the root directory of this repository. diff --git a/examples/led/top.pcf b/examples/led/top.pcf new file mode 100644 index 0000000..90f8874 --- /dev/null +++ b/examples/led/top.pcf @@ -0,0 +1,5 @@ +set_io -nowarn clk_100 J3 +set_io -nowarn LED[0] M12 +set_io -nowarn LED[1] R16 +set_io -nowarn BUT[0] K11 +set_io -nowarn BUT[1] P13 diff --git a/examples/led/top.v b/examples/led/top.v new file mode 100644 index 0000000..cd531eb --- /dev/null +++ b/examples/led/top.v @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: AGPL-3.0-Only +/* + * Copyright (C) 2022 Sean Anderson + */ + +`include "common.vh" + +module top ( + input SYSCLK, + + input [1:0] BUT, + output [1:0] LED +); + + parameter WISHBONE = 1; + + wire clk_125; + + SB_PLL40_CORE #( + .FEEDBACK_PATH("SIMPLE"), + .DIVR(4'd0), + .DIVF(7'd9), + .DIVQ(3'd3), + .FILTER_RANGE(3'd5), + ) pll ( + .REFERENCECLK(SYSCLK), + .PLLOUTGLOBAL(clk_125), + .BYPASS(1'b0), + .RESETB(1'b1) + ); + + wire [1:0] led_n; + assign LED = ~led_n; + + led_blinker #( + .LEDS(2) + ) blinker( + .clk(clk_125), + .triggers(~BUT), + .out(led_n), + .test_mode(1'b0) + ); + +endmodule