Sha256: 7cf52d9f7227e485aa686549499f0caddbf27c97a69d06b988b0758c88677e9c

Contents?: true

Size: 551 Bytes

Versions: 8

Compression:

Stored size: 551 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

8 entries across 8 versions & 1 rubygems

Version Path
ruby-vpi-17.0.0 samp/counter/counter.v
ruby-vpi-18.0.0 samp/counter/counter.v
ruby-vpi-19.0.0 examples/counter/counter.v
ruby-vpi-18.0.2 samp/counter/counter.v
ruby-vpi-18.0.1 samp/counter/counter.v
ruby-vpi-20.0.0 examples/counter/counter.v
ruby-vpi-21.1.0 examples/counter/counter.v
ruby-vpi-21.0.0 examples/counter/counter.v