Class: HDLRuby::Low::TimeWait
- 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_verilog.rb,
lib/HDLRuby/hruby_low2high.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb,
lib/HDLRuby/hruby_low_fix_types.rb,
lib/HDLRuby/hruby_low_bool2select.rb,
lib/HDLRuby/hruby_low_without_select.rb,
lib/HDLRuby/hruby_low_without_subsignals.rb,
lib/HDLRuby/hruby_low_casts_without_expression.rb
Overview
Describes a wait statement: not synthesizable!
Direct Known Subclasses
Constant Summary
Constants included from Low2Symbol
Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable
Instance Attribute Summary collapse
-
#delay ⇒ Object
readonly
The delay to wait.
Attributes included from Hparent
Instance Method Summary collapse
-
#boolean_in_assign2select! ⇒ Object
Converts booleans in assignments to select operators.
-
#casts_without_expression! ⇒ Object
Extracts the expressions from the casts.
-
#clone ⇒ Object
Clones the TimeWait (deeply).
-
#each_block(&ruby_block) ⇒ Object
Iterates over the sub blocks.
-
#each_block_deep(&ruby_block) ⇒ Object
Iterates over all the blocks contained in the current block.
-
#each_deep(&ruby_block) ⇒ Object
Iterates over each object deeply.
-
#each_node(&ruby_block) ⇒ Object
Iterates over the expression children if any.
-
#each_node_deep(&ruby_block) ⇒ Object
Iterates over the nodes deeply if any.
-
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements contained in the current block.
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#explicit_types! ⇒ Object
Explicit the types conversions in the time wait.
-
#extract_selects! ⇒ Object
Extract the Select expressions.
-
#hash ⇒ Object
Hash function.
-
#initialize(delay) ⇒ TimeWait
constructor
Creates a new statement waiting +delay+.
-
#map_nodes!(&ruby_block) ⇒ Object
Maps on the children (including the condition).
-
#set_delay!(delay) ⇒ Object
Sets the delay.
-
#signal2subs! ⇒ Object
Decompose the hierarchical signals in the statements.
-
#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 wait statement.
-
#to_verilog(spc = 3) ⇒ Object
Enhances TimeWait with generation of verilog code.
-
#to_vhdl(vars, level = 0) ⇒ Object
Generates the text of the equivalent HDLRuby::High code.
Methods inherited from Statement
#add_blocks_code, #add_make_block, #behavior, #block, #blocks2seq!, #break_types!, #delete_related!, #delete_unless!, #each_statement, #extract_declares!, #fix_scope_refnames!, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_ch, #to_seq!, #to_upper_space!, #top_block, #top_scope, #use_name?, #with_boolean!
Methods included from Low2Symbol
Methods included from Hparent
#absolute_ref, #hierarchy, #no_parent!, #scope
Constructor Details
#initialize(delay) ⇒ TimeWait
Creates a new statement waiting +delay+.
4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 |
# File 'lib/HDLRuby/hruby_low.rb', line 4290 def initialize(delay) # Check and set the delay. unless delay.is_a?(Delay) raise AnyError, "Invalid class for a delay: #{delay.class}." end super() @delay = delay # And set its parent. delay.parent = self end |
Instance Attribute Details
#delay ⇒ Object (readonly)
The delay to wait.
4287 4288 4289 |
# File 'lib/HDLRuby/hruby_low.rb', line 4287 def delay @delay end |
Instance Method Details
#boolean_in_assign2select! ⇒ Object
Converts booleans in assignments to select operators.
154 155 156 157 |
# File 'lib/HDLRuby/hruby_low_bool2select.rb', line 154 def boolean_in_assign2select! # Nothing to do. return self end |
#casts_without_expression! ⇒ Object
Extracts the expressions from the casts.
138 139 140 141 |
# File 'lib/HDLRuby/hruby_low_casts_without_expression.rb', line 138 def casts_without_expression! # Nothing to do. return self end |
#clone ⇒ Object
Clones the TimeWait (deeply)
4326 4327 4328 |
# File 'lib/HDLRuby/hruby_low.rb', line 4326 def clone return TimeWait.new(@delay.clone) end |
#each_block(&ruby_block) ⇒ Object
Iterates over the sub blocks.
4347 4348 4349 4350 4351 4352 |
# File 'lib/HDLRuby/hruby_low.rb', line 4347 def each_block(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_block) unless ruby_block # A ruby block? # Nothing to do. end |
#each_block_deep(&ruby_block) ⇒ Object
Iterates over all the blocks contained in the current block.
4355 4356 4357 4358 4359 4360 |
# File 'lib/HDLRuby/hruby_low.rb', line 4355 def each_block_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_block_deep) unless ruby_block # A ruby block? # Nothing to do. end |
#each_deep(&ruby_block) ⇒ Object
Iterates over each object deeply.
Returns an enumerator if no ruby block is given.
4311 4312 4313 4314 4315 4316 4317 4318 |
# File 'lib/HDLRuby/hruby_low.rb', line 4311 def each_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_deep) unless ruby_block # A ruby block? First apply it to current. ruby_block.call(self) # Then apply on the delay. self.delay.each_deep(&ruby_block) end |
#each_node(&ruby_block) ⇒ Object
Iterates over the expression children if any.
4331 4332 4333 4334 4335 4336 |
# File 'lib/HDLRuby/hruby_low.rb', line 4331 def each_node(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_node) unless ruby_block # A ruby block? # Nothing to do. end |
#each_node_deep(&ruby_block) ⇒ Object
Iterates over the nodes deeply if any.
4339 4340 4341 4342 4343 4344 |
# File 'lib/HDLRuby/hruby_low.rb', line 4339 def each_node_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_node_deep) unless ruby_block # A ruby block? First apply it to current. ruby_block.call(self) end |
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements contained in the current block.
4363 4364 4365 4366 4367 4368 4369 |
# File 'lib/HDLRuby/hruby_low.rb', line 4363 def each_statement_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_statement_deep) unless ruby_block # A ruby block? # Apply it on self. ruby_block.call(self) end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
4302 4303 4304 4305 4306 |
# File 'lib/HDLRuby/hruby_low.rb', line 4302 def eql?(obj) return false unless obj.is_a?(TimeWait) return false unless @delay.eql?(obj.delay) return true end |
#explicit_types! ⇒ Object
Explicit the types conversions in the time wait.
189 190 191 192 |
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 189 def explicit_types! # Nothing to do. return self end |
#extract_selects! ⇒ Object
Extract the Select expressions.
107 108 109 110 |
# File 'lib/HDLRuby/hruby_low_without_select.rb', line 107 def extract_selects! # Nothing to extract. return [] end |
#hash ⇒ Object
Hash function.
4321 4322 4323 |
# File 'lib/HDLRuby/hruby_low.rb', line 4321 def hash return [@delay].hash end |
#map_nodes!(&ruby_block) ⇒ Object
Maps on the children (including the condition).
1019 1020 1021 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 1019 def map_nodes!(&ruby_block) # Nothing to do. end |
#set_delay!(delay) ⇒ Object
Sets the delay.
1008 1009 1010 1011 1012 1013 1014 1015 1016 |
# File 'lib/HDLRuby/hruby_low_mutable.rb', line 1008 def set_delay!(delay) # Check and set the delay. unless delay.is_a?(Delay) raise AnyError, "Invalid class for a delay: #{delay.class}." end @delay = delay # And set its parent. delay.parent = self end |
#signal2subs! ⇒ Object
Decompose the hierarchical signals in the statements.
112 113 114 115 |
# File 'lib/HDLRuby/hruby_low_without_subsignals.rb', line 112 def signal2subs! # Nothing to do. return 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)
1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 1888 def to_c(res,level = 0) # The resulting string. # res = " " * level*3 res << " " * level*3 # Generate the wait. # res << "hw_wait(#{self.delay.to_c(level+1)}," + # "#{Low2C.behavior_access(self)});\n" res << "hw_wait(" self.delay.to_c(res,level+1) res << "," << Low2C.behavior_access(self) << ");\n" # Return the resulting string. return res end |
#to_hdr(level = 0) ⇒ Object
Generates the text of the equivalent hdr text. +level+ is the hierachical level of the object.
448 449 450 451 452 453 454 455 |
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 448 def to_hdr(level = 0) # The resulting string. res = " " * (level*3) # Generate the wait. res << "wait " << self.delay.to_hdr(level) << "\n" # Return the resulting string. return res end |
#to_high ⇒ Object
Creates a new high wait statement.
344 345 346 |
# File 'lib/HDLRuby/hruby_low2high.rb', line 344 def to_high return HDLRuby::High::TimeWait.new(self.delay.to_high) end |
#to_verilog(spc = 3) ⇒ Object
Enhances TimeWait with generation of verilog code.
1960 1961 1962 |
# File 'lib/HDLRuby/hruby_verilog.rb', line 1960 def to_verilog(spc = 3) return (" " * spc) + self.delay.to_verilog + "\n" end |
#to_vhdl(vars, level = 0) ⇒ Object
Generates the text of the equivalent HDLRuby::High code. +vars+ is the list of the variables and +level+ is the hierachical level of the object.
1062 1063 1064 1065 1066 1067 1068 1069 |
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 1062 def to_vhdl(vars,level = 0) # The resulting string. res = " " * (level*3) # Generate the wait. res << "wait for " << self.delay.to_vhdl(level) << ";\n" # Return the resulting string. return res end |