Class: HDLRuby::Low::TimeTerminate
- Defined in:
- lib/HDLRuby/hruby_low.rb,
lib/HDLRuby/hruby_low2c.rb,
lib/HDLRuby/hruby_low2vhd.rb,
lib/HDLRuby/hruby_verilog.rb,
lib/HDLRuby/hruby_low_fix_types.rb,
lib/HDLRuby/hruby_low_bool2select.rb,
lib/HDLRuby/hruby_low_without_select.rb
Overview
Extends the TimeTerminate class with functionality for converting select expressions to case statements.
Direct Known Subclasses
Constant Summary
Constants included from Low2Symbol
Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable
Instance Attribute Summary
Attributes included from Hparent
Instance Method Summary collapse
-
#boolean_in_assign2select! ⇒ Object
Converts booleans in assignments to select operators.
-
#clone ⇒ Object
Clones the TimeRepeat (deeply).
-
#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 all the nodes.
-
#each_node_deep(&ruby_block) ⇒ Object
Iterates over all the nodes deeply.
-
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements deeply.
-
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
-
#explicit_types! ⇒ Object
Explicit the types conversions in the statement.
-
#extract_selects! ⇒ Object
Extract the Select expressions.
-
#hash ⇒ Object
Hash function.
-
#initialize ⇒ TimeTerminate
constructor
Creates a new timed terminate statement that terminate execution.
-
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code.
-
#to_verilog(spc = 3) ⇒ Object
Converts the terminate to 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!, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_ch, #to_hdr, #to_high, #to_seq!, #to_upper_space!, #top_block, #top_scope, #use_name?, #with_boolean!
Methods included from Low2Symbol
Methods included from Hparent
Constructor Details
#initialize ⇒ TimeTerminate
Creates a new timed terminate statement that terminate execution.
4126 4127 4128 |
# File 'lib/HDLRuby/hruby_low.rb', line 4126 def initialize super() end |
Instance Method Details
#boolean_in_assign2select! ⇒ Object
Converts booleans in assignments to select operators.
84 85 86 87 |
# File 'lib/HDLRuby/hruby_low_bool2select.rb', line 84 def boolean_in_assign2select! # Nothing to do. return self end |
#clone ⇒ Object
Clones the TimeRepeat (deeply)
4189 4190 4191 |
# File 'lib/HDLRuby/hruby_low.rb', line 4189 def clone return TimeTerminate.new end |
#each_block_deep(&ruby_block) ⇒ Object
Iterates over all the blocks contained in the current block.
4170 4171 4172 4173 4174 4175 |
# File 'lib/HDLRuby/hruby_low.rb', line 4170 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 anyway. end |
#each_deep(&ruby_block) ⇒ Object
Iterates over each object deeply.
Returns an enumerator if no ruby block is given.
4133 4134 4135 4136 4137 4138 4139 |
# File 'lib/HDLRuby/hruby_low.rb', line 4133 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) # And that's all. end |
#each_node(&ruby_block) ⇒ Object
Iterates over all the nodes.
4142 4143 4144 4145 4146 4147 |
# File 'lib/HDLRuby/hruby_low.rb', line 4142 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 anyway. end |
#each_node_deep(&ruby_block) ⇒ Object
Iterates over all the nodes deeply.
4150 4151 4152 4153 4154 4155 4156 4157 |
# File 'lib/HDLRuby/hruby_low.rb', line 4150 def each_node_deep(&ruby_block) # No ruby block? Return an enumerator. return to_enum(:each_node_deep) unless ruby_block # A ruby block? # Apply of current node. ruby_block.call(self) # And that's all. end |
#each_statement_deep(&ruby_block) ⇒ Object
Iterates over all the statements deeply.
4160 4161 4162 4163 4164 4165 4166 4167 |
# File 'lib/HDLRuby/hruby_low.rb', line 4160 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 of current node. ruby_block.call(self) # And that's all. end |
#eql?(obj) ⇒ Boolean
Comparison for hash: structural comparison.
4178 4179 4180 4181 |
# File 'lib/HDLRuby/hruby_low.rb', line 4178 def eql?(obj) return false unless obj.is_a?(TimeTerminate) return true end |
#explicit_types! ⇒ Object
Explicit the types conversions in the statement.
117 118 119 120 |
# File 'lib/HDLRuby/hruby_low_fix_types.rb', line 117 def explicit_types! # Nothing to do. return self end |
#extract_selects! ⇒ Object
Extract the Select expressions.
183 184 185 186 |
# File 'lib/HDLRuby/hruby_low_without_select.rb', line 183 def extract_selects! # Nothing to extract. return [] end |
#hash ⇒ Object
Hash function.
4184 4185 4186 |
# File 'lib/HDLRuby/hruby_low.rb', line 4184 def hash return TimeTerminate.hash end |
#to_c(res, level = 0) ⇒ Object
Generates the C text of the equivalent HDLRuby code. +level+ is the hierachical level of the object.
1467 1468 1469 1470 |
# File 'lib/HDLRuby/hruby_low2c.rb', line 1467 def to_c(res,level = 0) # Save the value pool state. res << (" " * (level*3)) << "terminate();\n" end |
#to_verilog(spc = 3) ⇒ Object
Converts the terminate to Verilog code.
186 187 188 |
# File 'lib/HDLRuby/hruby_verilog.rb', line 186 def to_verilog(spc = 3) return "#{" " * spc}$finish;" 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.
935 936 937 938 |
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 935 def to_vhdl(vars,level = 0) # Generate a report statement. return " " * (level*3) + "finish;\n" end |