Class: OrigenStandardSubblocks::RAM
- Inherits:
-
Object
- Object
- OrigenStandardSubblocks::RAM
- Includes:
- Origen::Model
- Defined in:
- lib/origen_standard_subblocks/RAM/ram.rb
Overview
Note:
This currently assumes 32-bit addresses.
Note:
This currently assumes Big-Endian address space (e.g., the RAM grows upwards).
Simple subblock for modeling RAM.
Instance Method Summary collapse
-
#end_addr ⇒ Fixnum
(also: #end_address, #end, #last_addr, #last_address, #last)
Returns the end address: i.e., the last usable address (not the length).
-
#initialize(options = {}) ⇒ RAM
constructor
Create a new
OrigenStandardSubblocks::RAM
object. -
#length ⇒ Fixnum
(also: #size)
Returns the length of the RAM.
-
#start_addr ⇒ Fixnum
(also: #start_address, #start, #first_addr, #first_address, #first)
Returns the start address (frst usable address) in the RAM.
Constructor Details
#initialize(options = {}) ⇒ RAM
Note:
The length
option is a required option.
Create a new OrigenStandardSubblocks::RAM
object.
13 14 15 16 17 18 19 |
# File 'lib/origen_standard_subblocks/RAM/ram.rb', line 13 def initialize( = {}) @length = [:length] if @length.nil? Origen.app.fail(message: 'RAM subblock requires a :length option to be given!') end end |
Instance Method Details
#end_addr ⇒ Fixnum Also known as: end_address, end, last_addr, last_address, last
Note:
This assume 32-bit addresses
Returns the end address: i.e., the last usable address (not the length).
50 51 52 |
# File 'lib/origen_standard_subblocks/RAM/ram.rb', line 50 def end_addr start_addr + length - 4 end |
#length ⇒ Fixnum Also known as: size
Returns the length of the RAM
34 35 36 |
# File 'lib/origen_standard_subblocks/RAM/ram.rb', line 34 def length @length end |
#start_addr ⇒ Fixnum Also known as: start_address, start, first_addr, first_address, first
Returns the start address (frst usable address) in the RAM.
23 24 25 |
# File 'lib/origen_standard_subblocks/RAM/ram.rb', line 23 def start_addr base_address end |