Sha256: 9d3fa997764e443118a466c54f1757c8d8b27c34e8d7749ece28743312aa676f

Contents?: true

Size: 881 Bytes

Versions: 5

Compression:

Stored size: 881 Bytes

Contents

# This file is a behavioral specification for the design under test.

# lowest upper bound of counter's value
LIMIT = 2 ** Counter.Size.intVal

# maximum allowed value for a counter
MAX = LIMIT - 1

context "A resetted counter's value" do
  setup do
    Counter.reset!
  end

  specify "should be zero" do
    Counter.count.intVal.should == 0
  end

  specify "should increment by one count upon each rising clock edge" do
    LIMIT.times do |i|
      Counter.count.intVal.should == i
      relay_verilog # increment the counter
    end
  end
end

context "A counter with the maximum value" do
  setup do
    Counter.reset!

    # increment the counter to maximum value
    MAX.times {relay_verilog}
    Counter.count.intVal.should == MAX
  end

  specify "should overflow upon increment" do
    relay_verilog # increment the counter
    Counter.count.intVal.should == 0
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-vpi-12.0.0 samp/counter/counter_rspec_spec.rb
ruby-vpi-12.0.1 samp/counter/counter_rspec_spec.rb
ruby-vpi-13.0.0 samp/counter/counter_rspec_spec.rb
ruby-vpi-12.1.0 samp/counter/counter_rspec_spec.rb
ruby-vpi-12.0.2 samp/counter/counter_rspec_spec.rb