Class: HDLRuby::Low::TimeBlock

Inherits:
Block show all
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_cleanup.rb,
lib/HDLRuby/hruby_low_mutable.rb,
lib/HDLRuby/hruby_low_skeleton.rb,
lib/HDLRuby/hruby_low_with_var.rb

Overview

Extends the TimeBlock class with separation between signals and variables.

Direct Known Subclasses

High::TimeBlock

Constant Summary

Constants included from Low2Symbol

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

Instance Attribute Summary

Attributes inherited from Block

#mode, #name

Attributes included from Hparent

#parent

Instance Method Summary collapse

Methods inherited from Block

#add_blocks_code, #add_inner, #add_make_block, #add_variable, #att_sharp, #att_signal, #blocks2seq!, #boolean_in_assign2select!, #break_concat_assigns!, #casts_without_expression!, #change_branch, #clone, #delete_inner!, #delete_related!, #delete_statement!, #do_flat, #each_block, #each_block_deep, #each_deep, #each_inner, #each_node_deep, #each_signal_deep, #each_statement, #each_statement_deep, #explicit_types!, #extract_declares!, #extract_from_externals!, #flatten, #get_by_name, #get_inner, #get_variable, #initialize, #insert_statement!, #last_statement, #map_inners!, #map_statements!, #mix?, #num_statements, #par_in_seq2seq!, #reassign_expressions!, #refs_by_variables!, #repeat_to_verilog!, #replace_expressions!, #replace_names!, #replace_names_subs!, #replace_statement!, #res_name, #reverse_each_statement, #search_refname, #select2case!, #set_mode!, #set_name!, #set_statement!, #sym2var_name, #to_c, #to_c_code, #to_ch, #to_conversion, #to_seq!, #to_upper_space!, #to_verilog, #to_vhdl, #var2ref, #var_name2sym, #variable_name?, #variables

Methods included from ForceName

#extend_name!, #force_name!

Methods inherited from Statement

#add_blocks_code, #add_make_block, #behavior, #block, #blocks2seq!, #break_types!, #clone, #delete_related!, #each_deep, #each_statement, #explicit_types!, #extract_declares!, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_c, #to_ch, #to_seq!, #to_upper_space!, #to_vhdl, #top_block, #top_scope, #use_name?, #with_boolean!

Methods included from Low2Symbol

#to_sym

Methods included from Hparent

#hierarchy, #no_parent!, #scope

Constructor Details

This class inherits a constructor from HDLRuby::Low::Block

Instance Method Details

#add_statement(statement) ⇒ Object

Adds a +statement+.

NOTE: TimeBlock is supported.



4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
# File 'lib/HDLRuby/hruby_low.rb', line 4485

def add_statement(statement)
    unless statement.is_a?(Statement) then
        raise AnyError, 
              "Invalid class for a statement: #{statement.class}"
    end
    @statements << statement
    # And set its parent.
    statement.parent = self
    statement
end

#delete_unless!(keep) ⇒ Object

Removes the signals and corresponding assignments whose name is not in +keep+.



198
199
200
# File 'lib/HDLRuby/hruby_low_cleanup.rb', line 198

def delete_unless!(keep)
    # Nothing to cleanup.
end

#eql?(obj) ⇒ Boolean

Comparison for hash: structural comparison.

Returns:

  • (Boolean)


4511
4512
4513
4514
# File 'lib/HDLRuby/hruby_low.rb', line 4511

def eql?(obj)
    return false unless obj.is_a?(TimeBlock)
    return super(obj)
end

#hashObject

Hash function.



4517
4518
4519
# File 'lib/HDLRuby/hruby_low.rb', line 4517

def hash
    return super
end

#to_hdr(level = 0, header = true) ⇒ Object

Generates the text of the equivalent hdr text. +level+ is the hierachical level of the object.



515
516
517
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 515

def to_hdr(level = 0, header = true)
    super(level,header,true)
end

#to_highObject

Creates a new high time block statement.



351
352
353
354
355
356
357
# File 'lib/HDLRuby/hruby_low2high.rb', line 351

def to_high
    # Create the new block statement.
    res = HDLRuby::High::TimeBlock.new(self.mode,self.name)
    # Add the statements.
    self.each_statement { |stmnt| res.add_statement(stmnt.to_high) }
    return res
end

#unshift_statement(statement) ⇒ Object

Adds a +statement+ and the begining of the block

NOTE: TimeWait is not supported unless for TimeBlock objects.



4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
# File 'lib/HDLRuby/hruby_low.rb', line 4499

def unshift_statement(statement)
    unless statement.is_a?(Statement) then
        raise AnyError,
              "Invalid class for a statement: #{statement.class}"
    end
    @statements.unshift(statement)
    # And set its parent.
    statement.parent = self
    statement
end

#with_var(upper = nil) ⇒ Object

Converts to a variable-compatible block where +upper+ is the upper block if any.

NOTE: the result is a new block.



257
258
259
260
261
# File 'lib/HDLRuby/hruby_low_with_var.rb', line 257

def with_var(upper = nil)
    # For the specific case of block, the conversion is not
    # done.
    return self
end