Sha256: d7b642471d37007be77b4efc93119131794328fe8234ce570a4b913bc24042d3
Contents?: true
Size: 816 Bytes
Versions: 3
Compression:
Stored size: 816 Bytes
Contents
require 'spec' # lowest upper bound of counter's value LIMIT = 2 ** DUT.Size.intVal # maximum allowed value for a counter MAX = LIMIT - 1 describe "A #{DUT.name} after being reset" do setup do DUT.reset! # reset the counter end it "should be zero" do DUT.count.intVal.should == 0 end it "should increment upon each subsequent posedge" do LIMIT.times do |i| DUT.count.intVal.should == i DUT.cycle! # increment the counter end end end describe "A #{DUT.name} with the maximum value" do setup do DUT.reset! # reset the counter # increment the counter to maximum value MAX.times { DUT.cycle! } DUT.count.intVal.should == MAX end it "should overflow upon increment" do DUT.cycle! # increment the counter DUT.count.intVal.should == 0 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-vpi-20.0.0 | examples/counter/RSpec/counter_spec.rb |
ruby-vpi-21.0.0 | examples/counter/RSpec/counter_spec.rb |
ruby-vpi-21.1.0 | examples/counter/RSpec/counter_spec.rb |