Sha256: a7cc4924a3b554aefc452854c3a82e3e2a90951ce844e7d450bceda654c9bd5e

Contents?: true

Size: 737 Bytes

Versions: 24

Compression:

Stored size: 737 Bytes

Contents

# A simple generic adder
system :adder do |w|
    [(w-1)..0].input :i,:j
    [w..0].output :k

    k <= i.as(bit[w+1]) + j
end

# A module embedding two generic adders.
system :two_adders do |w|
    [w*2].input :x, :y
    [(w+1)*2].output :z

    adder(w).(:adderI0).(x[(w-1)..0],y[(w-1)..0],z[w..0])
    adder(w).(:adderI1).(x[(w*2-1)..w],y[(w*2-1)..w],z[(w*2+1)..(w+1)])
end


# Testing the generic adder.
system :adder_bench do
    width = 4
    [width*2].inner :a,:b
    [(width+1)*2].inner :c

    two_adders(width).(:my_adders).(a,b,c)

    timed do
        a <= 0
        b <= 0
        !10.ns
        a <= 1
        !10.ns
        b <= 1
        !10.ns
        a <= 255
        !10.ns
        b <= 128
        !10.ns
    end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
HDLRuby-3.4.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.3.4 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.3.3 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.3.1 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.3.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.2.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.1.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-3.0.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.12 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.11 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.10 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.9 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.8 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.7 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.5 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.4 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.3 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.2 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.11.0 lib/HDLRuby/hdr_samples/adder_gen_gen.rb
HDLRuby-2.10.5 lib/HDLRuby/hdr_samples/adder_gen_gen.rb