initial commit
This commit is contained in:
40
step2.v
Normal file
40
step2.v
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Step 2: Blinker (slower version)
|
||||
* DONE*
|
||||
*/
|
||||
|
||||
`default_nettype none
|
||||
`include "clockworks.v"
|
||||
|
||||
module SOC (
|
||||
input clk, // system clock
|
||||
input rst_i, // reset button
|
||||
output [4:0] led, // system LEDs
|
||||
input RXD, // UART receive
|
||||
output TXD // UART transmit
|
||||
);
|
||||
|
||||
wire clkI; // internal clock
|
||||
wire resetn; // internal reset signal, goes low on reset
|
||||
|
||||
// A blinker that counts on 5 bits, wired to the 5 LEDs
|
||||
reg [4:0] count = 0;
|
||||
always @(posedge clkI) begin
|
||||
count <= !resetn ? 0 : count + 1;
|
||||
end
|
||||
|
||||
// Clock gearbox (to let you see what happens)
|
||||
// and reset circuitry (to workaround an
|
||||
// initialization problem with Ice40)
|
||||
Clockworks #(
|
||||
.SLOW(21) // Divide clock frequency by 2^21
|
||||
)CW(
|
||||
.CLK(clk),
|
||||
.RESET(rst_i),
|
||||
.clk(clkI),
|
||||
.resetn(resetn)
|
||||
);
|
||||
|
||||
assign led = count;
|
||||
assign TXD = 1'b0; // not used for now
|
||||
endmodule
|
Reference in New Issue
Block a user