Actions

FPGAExercise10code: Difference between revisions

From HacDC Wiki

(Created page with 'Counter module to be used with the Spartan 3E Board tutorial. <pre> module counter(clock, count_out); input clock; output [3:0] count_out; reg [3:0] count_int=0; reg [26:0] t=0;…')
 
No edit summary
 
Line 1: Line 1:
Counter module to be used with the Spartan 3E Board tutorial.
Counter module to be used with the [http://wiki.hacdc.org/index.php/File:ISE_Tutorial_for_S3E.pdf Spartan 3E Board tutorial].


<pre>
<pre>

Latest revision as of 19:16, 23 December 2009

Counter module to be used with the Spartan 3E Board tutorial.

module counter(clock, count_out);
input clock;
output [3:0] count_out;
reg [3:0] count_int=0;
reg [26:0] t=0;

always @(posedge clock)
if (t==4)
    begin
        count_int <= count_int + 1;
        t=0;
    end
else
    t=t+1;

assign count_out=count_int;

endmodule