Class: HDLRuby::Low::TimeBehavior
- Defined in:
- lib/HDLRuby/hruby_db.rb,
lib/HDLRuby/hruby_low.rb,
lib/HDLRuby/hruby_low2c.rb,
lib/HDLRuby/hruby_low2hdr.rb,
lib/HDLRuby/hruby_low2vhd.rb,
lib/HDLRuby/hruby_low2high.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb
Overview
Describes a timed behavior.
NOTE:
- this is the only kind of behavior that can include time statements.
- this kind of behavior is not synthesizable!
Direct Known Subclasses
Constant Summary
Constants included from Low2Symbol
Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes inherited from Behavior
Attributes included from Hparent
Instance Method Summary collapse
-
#add_event(event) ⇒ Object
Time behavior do not have other event than time, so deactivate the relevant methods.
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#hash ⇒ Object
Hash function.
-
#initialize(block) ⇒ TimeBehavior
constructor
Creates a new time behavior executing +block+.
-
#set_block!(block) ⇒ Object
Sets the block.
-
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code.
-
#to_hdr(level = 0) ⇒ Object
Generates the text of the equivalent hdr text.
-
#to_high ⇒ Object
Creates a new high time behavior.
Methods inherited from Behavior
#blocks2seq!, #delete_event!, #each_block, #each_block_deep, #each_deep, #each_event, #each_node_deep, #each_statement, #explicit_types!, #extract_declares!, #get_by_name, #has_event?, #last_statement, #map_events!, #mixblocks2seq!, #on_edge?, #on_event?, #parent_system, #replace_names!, #reverse_each_statement, #to_ch, #to_upper_space!, #to_vhdl, #top_scope, #with_boolean!, #with_var!
Methods included from Low2Symbol
Methods included from Hparent
#hierarchy, #no_parent!, #scope
Constructor Details
#initialize(block) ⇒ TimeBehavior
Creates a new time behavior executing +block+.
2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 |
# File 'lib/HDLRuby/hruby_low.rb', line 2378 def initialize(block) # Initialize the sensitivity list. @events = [] # Check and set the block. unless block.is_a?(Block) raise AnyError, "Invalid class for a block: #{block.class}." end # Time blocks are supported here. @block = block block.parent = self end |
Instance Method Details
#add_event(event) ⇒ Object
Time behavior do not have other event than time, so deactivate the relevant methods.
2405 2406 2407 |
# File 'lib/HDLRuby/hruby_low.rb', line 2405 def add_event(event) raise AnyError, "Time behaviors do not have any sensitivity list." end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
2391 2392 2393 2394 2395 2396 |
# File 'lib/HDLRuby/hruby_low.rb', line 2391 def eql?(obj) # Specific comparison. return false unless obj.is_a?(TimeBehavior) # General comparison. return super(obj) end |
#hash ⇒ Object
Hash function.
2399 2400 2401 |
# File 'lib/HDLRuby/hruby_low.rb', line 2399 def hash super end |
#set_block!(block) ⇒ Object
Sets the block.
421 422 423 424 425 426 427 428 429 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 421 def set_block!(block) # Check and set the block. unless block.is_a?(Block) raise AnyError, "Invalid class for a block: #{block.class}." end # Time blocks are supported here. @block = block block.parent = self end |
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code. +level+ is the hierachical level of the object. def to_c(level = 0)
848 849 850 851 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 848 def to_c(res,level = 0) # super(level,true) super(res,level,true) end |
#to_hdr(level = 0) ⇒ Object
Generates the text of the equivalent hdr text. +level+ is the hierachical level of the object.
282 283 284 |
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 282 def to_hdr(level = 0) super(level,true) end |
#to_high ⇒ Object
Creates a new high time behavior.
143 144 145 146 147 148 149 |
# File 'lib/HDLRuby/hruby_low2high.rb', line 143 def to_high # Create the resulting behavior. res = HDLRuby::High::TimeBehavior.new(self.block.to_high) # Adds the events. self.each_event { |ev| res.add_event(ev.to_high) } return res end |