Class: HDLRuby::Low::TimeBehavior
- Defined in:
- 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!, #break_concat_assigns!, #delete_event!, #each_block, #each_block_deep, #each_deep, #each_event, #each_node_deep, #each_statement, #explicit_types!, #extract_declares!, #fix_scope_refnames!, #get_by_name, #has_event?, #last_statement, #map_events!, #mixblocks2seq!, #on_edge?, #on_event?, #parent_system, #replace_names!, #reverse_each_statement, #signal2subs!, #to_ch, #to_upper_space!, #to_vhdl, #top_scope, #with_boolean!, #with_var!
Methods included from Low2Symbol
Methods included from Hparent
#absolute_ref, #hierarchy, #no_parent!, #scope
Constructor Details
#initialize(block) ⇒ TimeBehavior
Creates a new time behavior executing +block+.
2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 |
# File 'lib/HDLRuby/hruby_low.rb', line 2568 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.
2595 2596 2597 |
# File 'lib/HDLRuby/hruby_low.rb', line 2595 def add_event(event) raise AnyError, "Time behaviors do not have any sensitivity list." end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
2581 2582 2583 2584 2585 2586 |
# File 'lib/HDLRuby/hruby_low.rb', line 2581 def eql?(obj) # Specific comparison. return false unless obj.is_a?(TimeBehavior) # General comparison. return super(obj) end |
#hash ⇒ Object
Hash function.
2589 2590 2591 |
# File 'lib/HDLRuby/hruby_low.rb', line 2589 def hash super end |
#set_block!(block) ⇒ Object
Sets the block.
402 403 404 405 406 407 408 409 410 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 402 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)
850 851 852 853 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 850 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.
287 288 289 |
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 287 def to_hdr(level = 0) super(level,true) end |
#to_high ⇒ Object
Creates a new high time behavior.
154 155 156 157 158 159 160 |
# File 'lib/HDLRuby/hruby_low2high.rb', line 154 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 |