diff options
author | bryan newbold <bnewbold@leaflabs.com> | 2013-10-04 21:46:17 -0400 |
---|---|---|
committer | bryan newbold <bnewbold@leaflabs.com> | 2013-10-04 21:46:17 -0400 |
commit | 1ad824a33038856ae9a61379b4f78f1f6e888fe8 (patch) | |
tree | 2bfa16bae550df4cdef9b9b360c9db3b5f159dda /hdl/main_sp605.v | |
parent | a9cdeccc5c32979b44c3fb7cd2c86ed564adcfda (diff) | |
download | basic-hdl-template-1ad824a33038856ae9a61379b4f78f1f6e888fe8.tar.gz basic-hdl-template-1ad824a33038856ae9a61379b4f78f1f6e888fe8.zip |
add concept of 'board' for seperate ucfs and top level modules
Diffstat (limited to 'hdl/main_sp605.v')
-rw-r--r-- | hdl/main_sp605.v | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/hdl/main_sp605.v b/hdl/main_sp605.v new file mode 100644 index 0000000..1b4f9f2 --- /dev/null +++ b/hdl/main_sp605.v @@ -0,0 +1,31 @@ +// very minimal example top-level module + +module main ( + output reg [3:0] gpio_led, + input wire [3:0] gpio_switch, + input wire SYSTEMCLOCK, + input wire PUSH_BUTTON_RESET_RAW // this is active low + ); + + wire reset; + assign reset = !PUSH_BUTTON_RESET_RAW; + + reg [25:0] throb_counter = 0; + + always @(posedge SYSTEMCLOCK) begin + if (reset) begin + gpio_led <= 7'b1111; + throb_counter <= 26'd0; + end else begin + gpio_led[1:0] <= gpio_switch[1:0]; + gpio_led[2] <= gpio_switch[2] || gpio_switch[3]; + if (throb_counter >= 26'd50_000_000) begin + gpio_led[3] <= !gpio_led[3]; + throb_counter <= 26'd0; + end else begin + throb_counter <= throb_counter + 26'd1; + end + end + end + +endmodule |