Add LED example

Add a small LED example to let me test the blinker functionality.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Sean Anderson 2023-03-15 14:04:37 -04:00
parent 8887f774d0
commit 01f9d96173
4 changed files with 61 additions and 0 deletions

View File

@ -6,3 +6,4 @@ cores in this project.
:leveloffset: +1
include::breakout_hub/README.adoc[]
include::led/README.adoc[]

11
examples/led/README.adoc Normal file
View File

@ -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.

5
examples/led/top.pcf Normal file
View File

@ -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

44
examples/led/top.v Normal file
View File

@ -0,0 +1,44 @@
// SPDX-License-Identifier: AGPL-3.0-Only
/*
* Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
*/
`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