Class: SystemRDL::Evaluator::MemInstance
Instance Attribute Summary
#address, #alignment, #stride
#array_info
#external
Attributes inherited from Instance
#array_info, #definition, #instances, #name, #parent, #properties, #token_range
Instance Method Summary
collapse
#sw_readable?, #sw_writable?
#array?, #array_indices, #array_sizes, #first_element?, #last_element?
Methods inherited from Instance
#addrmap?, #array?, #element_name, #field?, #finalize, #find_addrmap, #full_name, #initialize, #layer, #mem?, #property, #property_value, #reg?, #regfile?, #revalidate, #root?, #structural_component?, #to_value, #upper_instances, #validate
Instance Method Details
#accesswidth ⇒ Object
169
170
171
|
# File 'lib/systemrdl/evaluator/mem.rb', line 169
def accesswidth
(instances.empty? && entrywidth) || super
end
|
#definable?(definition) ⇒ Boolean
181
182
183
|
# File 'lib/systemrdl/evaluator/mem.rb', line 181
def definable?(definition)
definition.layer in :reg | :field
end
|
#entrywidth ⇒ Object
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/systemrdl/evaluator/mem.rb', line 152
def entrywidth
@entrywidth ||=
if (memwidth = property_value(:memwidth)&.value)
if memwidth <= 8
8
elsif memwidth.nobits?(memwidth - 1)
memwidth
else
2**memwidth.bit_length
end
else
instances
.map { |inst| inst.property_value(:regwidth).value }
.max
end
end
|
#instantiable?(definition) ⇒ Boolean
185
186
187
|
# File 'lib/systemrdl/evaluator/mem.rb', line 185
def instantiable?(definition)
definition.layer in :reg
end
|
#size ⇒ Object
173
174
175
176
177
178
179
|
# File 'lib/systemrdl/evaluator/mem.rb', line 173
def size
@size ||= begin
width = entrywidth / 8
entries = property_value(:mementries).value
width * entries
end
end
|