summaryrefslogtreecommitdiff
path: root/techlibs/xilinx/example_sim_counter/counter.v
blob: 72208bd80d14fe87cb2bc042c8f45911c05a848b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module counter (clk, rst, en, count);

   input clk, rst, en;
   output reg [3:0] count;
   
   always @(posedge clk)
      if (rst)
         count <= 4'd0;
      else if (en)
         count <= count + 4'd1;

endmodule