Sha256: b0004ba891954ce306e7e83369574fa52220bcd316264529fca6b177f8853843

Contents?: true

Size: 521 Bytes

Versions: 12

Compression:

Stored size: 521 Bytes

Contents

/**
  A simple up-counter with synchronous reset.

  @param	Size     Number of bits used to represent the counter's value.
  @param	clock    Increments the counter's value upon each positive edge.
  @param	reset    Zeroes the counter's value when asserted.
  @param	count    The counter's value.
*/
module counter #(parameter Size = 5) (
  input clock,
  input reset,
  output reg [Size - 1 : 0] count
);
  always @(posedge clock) begin
    if (reset)
      count <= 0;
    else
      count <= count + 1;
  end
endmodule

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby-vpi-11.1.1 samp/counter/counter.v
ruby-vpi-12.0.1 samp/counter/counter.v
ruby-vpi-12.0.0 samp/counter/counter.v
ruby-vpi-12.0.2 samp/counter/counter.v
ruby-vpi-12.1.0 samp/counter/counter.v
ruby-vpi-13.0.0 samp/counter/counter.v
ruby-vpi-14.0.0 samp/counter/counter.v
ruby-vpi-15.0.2 samp/counter/counter.v
ruby-vpi-15.0.0 samp/counter/counter.v
ruby-vpi-15.0.1 samp/counter/counter.v
ruby-vpi-16.0.1 samp/counter/counter.v
ruby-vpi-16.0.0 samp/counter/counter.v