Class: HDLRuby::Low::TimeTerminate

Inherits:
Statement
  • Object
show all
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

High::TimeTerminate

Constant Summary

Constants included from Low2Symbol

Low2Symbol::Low2SymbolPrefix, Low2Symbol::Low2SymbolTable, Low2Symbol::Symbol2LowTable

Instance Attribute Summary

Attributes included from Hparent

#parent

Instance Method Summary collapse

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

#to_sym

Methods included from Hparent

#hierarchy, #no_parent!, #scope

Constructor Details

#initializeTimeTerminate

Creates a new timed terminate statement that terminate execution.



4160
4161
4162
# File 'lib/HDLRuby/hruby_low.rb', line 4160

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

#cloneObject

Clones the TimeRepeat (deeply)



4223
4224
4225
# File 'lib/HDLRuby/hruby_low.rb', line 4223

def clone
    return TimeTerminate.new
end

#each_block_deep(&ruby_block) ⇒ Object

Iterates over all the blocks contained in the current block.



4204
4205
4206
4207
4208
4209
# File 'lib/HDLRuby/hruby_low.rb', line 4204

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.



4167
4168
4169
4170
4171
4172
4173
# File 'lib/HDLRuby/hruby_low.rb', line 4167

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.



4176
4177
4178
4179
4180
4181
# File 'lib/HDLRuby/hruby_low.rb', line 4176

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.



4184
4185
4186
4187
4188
4189
4190
4191
# File 'lib/HDLRuby/hruby_low.rb', line 4184

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.



4194
4195
4196
4197
4198
4199
4200
4201
# File 'lib/HDLRuby/hruby_low.rb', line 4194

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.

Returns:

  • (Boolean)


4212
4213
4214
4215
# File 'lib/HDLRuby/hruby_low.rb', line 4212

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

#hashObject

Hash function.



4218
4219
4220
# File 'lib/HDLRuby/hruby_low.rb', line 4218

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.



1472
1473
1474
1475
# File 'lib/HDLRuby/hruby_low2c.rb', line 1472

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