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 <seanga2@gmail.com>
This commit is contained in:
parent
01f9d96173
commit
508b090983
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
This directory contains an example design to test the LED blinkers. It runs on an
|
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].
|
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
|
To compile this design, run
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,17 @@ module led_blinker (
|
||||||
parameter LEDS = 2;
|
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 */
|
/* 16 cycles */
|
||||||
localparam TEST_TIMER_RESET = 21'h13333f;
|
localparam TEST_TIMER_RESET = 22'h15557f;
|
||||||
|
|
||||||
reg active, active_next;
|
reg active, active_next;
|
||||||
reg [LEDS - 1:0] out_next, triggered, triggered_next;
|
reg [LEDS - 1:0] out_next, triggered, triggered_next;
|
||||||
reg [20:0] lfsr, lfsr_next;
|
reg [21:0] lfsr, lfsr_next;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
active = 0;
|
active = 0;
|
||||||
|
@ -45,7 +45,7 @@ module led_blinker (
|
||||||
active_next = active;
|
active_next = active;
|
||||||
triggered_next = triggered | triggers;
|
triggered_next = triggered | triggers;
|
||||||
out_next = out;
|
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 (&lfsr) begin
|
||||||
if (active) begin
|
if (active) begin
|
||||||
active_next = 0;
|
active_next = 0;
|
||||||
|
|
Loading…
Reference in New Issue