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-3.4.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.3.4 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.3.3 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.3.1 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.3.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.2.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.1.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-3.0.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.12 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.11 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.10 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.9 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.8 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.7 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.5 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.4 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.3 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.2 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.11.0 lib/HDLRuby/hdr_samples/neural/selector.rb
HDLRuby-2.10.5 lib/HDLRuby/hdr_samples/neural/selector.rb