Skip to content

Instantly share code, notes, and snippets.

@corecode
Created June 8, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corecode/ee75db6a9aec45af277b018b9a9aac98 to your computer and use it in GitHub Desktop.
Save corecode/ee75db6a9aec45af277b018b9a9aac98 to your computer and use it in GitHub Desktop.
`default_nettype none
module top
(
output [7:0] out,
output nenable,
inout irq,
input spi_cs,
input spi_clk,
input spi_di,
inout spi_do,
inout i2c_scl,
inout i2c_sda,
output [2:0] led_rgb
);
wire clk;
SB_HFOSC #(.CLKHF_DIV("0b01"))
osc(.CLKHFPU(1),
.CLKHFEN(1'b1),
.CLKHF(clk));
reg [7:0] reset_counter;
wire reset;
initial reset_counter = 0;
initial reset = 1;
always @(posedge clk)
if (reset) begin
reset_counter <= reset_counter + 1;
reset <= ~&reset_counter;
end
reg [25:0] counter;
always @(posedge clk)
if (reset)
counter <= 0;
else
counter <= counter + 1;
assign out = counter[17:10];
assign led_rgb = 3'b111;//counter[25:22];
assign nenable = reset;
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment