Holey_yan

20141009_KUAS_Verilog_SyynchoronousCounter_Mod24

Oct 17th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*******************************************/
  2. /** 20141009 SyynchoronousCounter (Mod24) **/
  3. /** Maker  : Yan                          **/
  4. /** E-Mail : [email protected]        **/
  5. /** Date   : 2014/10/09 pm.10:15          **/
  6. /*******************************************/
  7.  
  8. module SyynchoronousCounter_Mod24(Clk, reset, _output);
  9.     input       Clk, reset;
  10.     output reg  [4:0]   _output;
  11.    
  12.     always @(negedge Clk)
  13.     begin
  14.         if(reset == 0)
  15.         begin
  16.             if(_output == 23)
  17.             begin
  18.                 _output = 0;
  19.             end
  20.             else if(_output < 23)
  21.             begin
  22.                 _output = _output + 1;
  23.             end            
  24.         end
  25.         else if(reset == 1)
  26.         begin
  27.             _output = 0;
  28.         end
  29.     end
  30. endmodule
Advertisement
Add Comment
Please, Sign In to add comment