Sha256: 523790c2d4050810a280c49b026fa562549aae20f07920ef7622bc2131f6a044

Contents?: true

Size: 804 Bytes

Versions: 100

Compression:

Stored size: 804 Bytes

Contents

##
# Module generating the selector that decides if a neuron is to update or not.
# Params:
# - +skip+: the number of clocks to skip.
system :selector do |skip|
    input :clk, :reset
    output :enable_update

    # The clock counter.
    [Math::log2(skip).ceil].inner :counter

    # The behavior handling the skip counter
    par(clk.posedge) do
        hif(reset == 1) { counter <= 0 }
        helse do
            hif(counter == skip-1) { counter <=0 }
            helse        {counter <= counter + 1 }
        end
    end

    # The behavior handling the update signal
    par(clk.posedge) do
        hif(reset == 1) { enable_update <= 0 }
        helse do
            hif(counter == skip-1) { enable_update <= 1 }
            helse                  { enable_update <= 0 }
        end
    end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
HDLRuby-2.10.3 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.10.2 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.9.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.8.1 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.7.11 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.7.5 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.7.1 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.25 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.24 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.23 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.22 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.19 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.18 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.16 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.15 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.10 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.8 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.5 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.4 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.6.3 lib/HDLRuby/hdr_samples/neural/selector.rb