lib/origen/registers/reg.rb
# Add a bus to the register, should only be called internally
Add a bus to the register, should only be called internally
Add a bus to the register should only be called internally
def add_bus(id, position, size, options = {}) 
        default_data = 0
        size.times do |n|
          default_data |= @bits[position + n].data << n
        end
        options = { data: default_data,  
                    res:  default_data,   
                  }.merge(options)
        @lookup[id] = { pos: position, bits: size }
        size.times do |n|
          bit_options = options.dup
          bit_options[:data] = options[:data][n]
          if options[:res].is_a?(Symbol)
            bit_options[:res]  = options[:res]
          else
            bit_options[:res]  = options[:res][n]
          end
          @bits.delete_at(position + n)
          @bits.insert(position + n, Bit.new(self, position + n, bit_options))
        end
        self
      end
def add_bus ( id , position , size , options = { } ) default_data = 0 size . times do | n | default_data |= @bits [ position + n ] . data << n end options = { data : default_data , res : default_data , } . merge ( options ) @lookup [ id ] = { pos : position , bits : size } size . times do | n | bit_options = options . dup bit_options [ :data ] = options [ :data ] [ n ] if options [ :res ] . is_a? ( Symbol ) bit_options [ :res ] = options [ :res ] else bit_options [ :res ] = options [ :res ] [ n ] end @bits . delete_at ( position + n ) @bits . insert ( position + n , Bit . new ( self , position + n , bit_options ) ) end self end
Add a bus to the register, should only be called internally
Add a bus to the register should only be called internally
# :nodoc: # If undefined preserve any data/reset value that has # already been applied at reg level
id
<not_specific>
position
<not_specific>
size
<not_specific>
options
<not_specific>