Commit 330b0221 authored by Alan Wood's avatar Alan Wood

Added Basic blink example

parent e5e987bc
This diff is collapsed.
This diff is collapsed.
module LED_top(
// 50MHz clock input
input clk,
// Input from buttons (active low)
// input [3:0]sw_n,
// Outputs to the 8 onboard LEDs
output[3:0]LED,
);
wire rst = 1'b0;//~sw_n[3]; // make reset active high
// these signals should be high-z when not used
//assign sw1 = 1'bz;
//assign sw2 = 1'bz;
//assign sw3 = 1'bz;
assign LED[3:1] = 3'b111;
blinker awesome_blinker (
.clk(clk),
.rst(rst),
.blink(LED[0])
);
endmodule
LED.bin: LED_top.v iCE40.pcf
yosys -q -p "synth_ice40 -blif LED.blif" LED_top.v blinker.v
arachne-pnr -d 8k -P tq144:4k -p iCE40.pcf LED.blif -o LED.txt
# arachne-pnr -d 8k -p iCE40.pcf LED.blif -o LED.txt
# icebox_explain rot.txt > rot.ex
icepack LED.txt LED.bin
upload:
iceprog -S LED.bin
clean:
rm -f LED.blif LED.txt LED.ex LED.bin
module blinker(
input clk,
input rst,
output blink
);
reg [24:0] counter_d, counter_q;
assign blink = counter_q[24];
always @(counter_q) begin
counter_d = counter_q + 1'b1;
end
always @(posedge clk) begin
if (rst) begin
counter_q <= 25'b0;
end else begin
counter_q <= counter_d;
end
end
endmodule
# User Constraint File for iCE40hx8k Breakout Board
#myStorm leds
set_io LED[0] 37
set_io LED[1] 38
set_io LED[2] 39
set_io LED[3] 41
# Onboard LEDs
#set_io LED[0] B5
#set_io LED[1] B4
#set_io LED[2] A2
#set_io LED[3] A1
#set_io LED[4] C5
#set_io LED[5] C4
#set_io LED[6] B3
#set_io LED[7] C3
# Onboard 12Mhz oscillator
#set_io clk J3
set_io clk 129
blink LED D9 using 12Mhz internal oscillator
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment