From 508b0909833419b49670c0abd22b70e8c84ac7e1 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 15 Mar 2023 14:06:04 -0400 Subject: [PATCH] led_blinker: Decrease blink speed to 15 Hz 15 Hz is more obviously "blinky" than 30 Hz (at least at 50% duty cycle). Signed-off-by: Sean Anderson --- examples/led/README.adoc | 2 +- rtl/led_blinker.v | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/led/README.adoc b/examples/led/README.adoc index 03e977c..ab640a6 100644 --- a/examples/led/README.adoc +++ b/examples/led/README.adoc @@ -2,7 +2,7 @@ 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. +Pushing the buttons will cause the LEDs to blink at 15 Hz. To compile this design, run diff --git a/rtl/led_blinker.v b/rtl/led_blinker.v index 0314386..c5fd780 100644 --- a/rtl/led_blinker.v +++ b/rtl/led_blinker.v @@ -22,17 +22,17 @@ module led_blinker ( parameter LEDS = 2; /* - * $ scripts/lfsr.py 0x140000 0x1fffff 16 + * $ scripts/lfsr.py 0x300000 4166667 16 * - * 16.78 ms + * 33.33 ms */ - localparam TIMER_RESET = 21'h1ffffe; + localparam TIMER_RESET = 22'h27b194; /* 16 cycles */ - localparam TEST_TIMER_RESET = 21'h13333f; + localparam TEST_TIMER_RESET = 22'h15557f; reg active, active_next; reg [LEDS - 1:0] out_next, triggered, triggered_next; - reg [20:0] lfsr, lfsr_next; + reg [21:0] lfsr, lfsr_next; initial begin active = 0; @@ -45,7 +45,7 @@ module led_blinker ( active_next = active; triggered_next = triggered | triggers; out_next = out; - lfsr_next = { lfsr[19:0], lfsr[20] ^ lfsr[18] }; + lfsr_next = { lfsr[20:0], lfsr[21] ^ lfsr[20] }; if (&lfsr) begin if (active) begin active_next = 0;