Sha256: 08ef60c2182630fce4880710415b688d2cd6eb9999146c22f14f8624c609b4da

Contents?: true

Size: 781 Bytes

Versions: 7

Compression:

Stored size: 781 Bytes

Contents

# Test the comparison operators.

# A benchmark for the if statement.
system :if_bench do
    [8].inner :x, :z

    par do
        hcase(x)
        hwhen(0)  { z <= 0 }
        hwhen(1)  { z <= 1 }
        hwhen(2)  { z <= 4 }
        hwhen(3)  { z <= 9 }
        hwhen(4)  { z <= 16 }
        hwhen(5)  { z <= 25 }
        hwhen(6)  { z <= 36 }
        hwhen(7)  { z <= 49 }
        hwhen(8)  { z <= 64 }
        hwhen(9)  { z <= 81 }
        hwhen(10) { z <= 100 }
        hwhen(11) { z <= 121 }
        hwhen(12) { z <= 144 }
        hwhen(13) { z <= 169 }
        hwhen(14) { z <= 196 }
        hwhen(15) { z <= 225 }
        helse    { z <= _zzzzzzzz }
    end

    timed do
        !10.ns
        20.times do |i|
            x <= i
            !10.ns
        end
    end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
HDLRuby-2.10.5 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.10.3 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.10.2 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.9.0 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.8.1 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.7.11 lib/HDLRuby/hdr_samples/case_bench.rb
HDLRuby-2.7.5 lib/HDLRuby/hdr_samples/case_bench.rb