Class: LinkDemo::Port
- Inherits:
-
Object
- Object
- LinkDemo::Port
- Includes:
- Origen::Model
- Defined in:
- lib/link_demo/port.rb
Instance Attribute Summary (collapse)
-
- (Object) size
readonly
Returns the value of attribute size.
Instance Method Summary (collapse)
-
- (Port) initialize(options = {})
constructor
A new instance of Port.
- - (Object) instantiate_registers
Constructor Details
- (Port) initialize(options = {})
Returns a new instance of Port
7 8 9 10 11 12 13 14 |
# File 'lib/link_demo/port.rb', line 7 def initialize( = {}) # Defines the default option values = { size: 32 }.merge() @size = [:size] instantiate_registers end |
Instance Attribute Details
- (Object) size (readonly)
Returns the value of attribute size
5 6 7 |
# File 'lib/link_demo/port.rb', line 5 def size @size end |
Instance Method Details
- (Object) instantiate_registers
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/link_demo/port.rb', line 16 def instantiate_registers size.times do |i| # Port control register reg "pcr#{i}".to_sym, i * 4 do |reg| reg.bit 24, :isf, access: :w1c reg.bits 19..16, :irqc reg.bit 15, :lk reg.bits 10..8, :mux reg.bit 6, :dse reg.bit 5, :ode reg.bit 4, :pfe reg.bit 2, :sre reg.bit 1, :pe reg.bit 0, :ps end end end |