Class: HDLRuby::High::TimeWait

Inherits:
Low::TimeWait show all
Includes:
HStatement
Defined in:
lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/hruby_rsim.rb,
lib/HDLRuby/hruby_rcsim.rb,
lib/HDLRuby/hruby_rsim_vcd.rb

Overview

Enhance the TimeWait class with VCD support.

Constant Summary

Constants included from Low::Low2Symbol

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

Instance Attribute Summary collapse

Attributes inherited from Low::TimeWait

#delay

Attributes included from Low::Hparent

#parent

Instance Method Summary collapse

Methods included from HStatement

#hif

Methods inherited from Low::TimeWait

#boolean_in_assign2select!, #casts_without_expression!, #clone, #each_block, #each_block_deep, #each_deep, #each_node, #each_node_deep, #each_statement_deep, #eql?, #explicit_types!, #extract_selects!, #hash, #initialize, #map_nodes!, #set_delay!, #to_c, #to_hdr, #to_high, #to_verilog, #to_vhdl

Methods inherited from Low::Statement

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

Methods included from Low::Low2Symbol

#to_sym

Methods included from Low::Hparent

#hierarchy, #no_parent!, #scope

Constructor Details

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

Instance Attribute Details

#rcstatementObject (readonly)

Returns the value of attribute rcstatement.



641
642
643
# File 'lib/HDLRuby/hruby_rcsim.rb', line 641

def rcstatement
  @rcstatement
end

Instance Method Details

#execute(mode) ⇒ Object

Executes the statement.



750
751
752
753
754
755
756
757
758
759
760
761
762
763
# File 'lib/HDLRuby/hruby_rsim.rb', line 750

def execute(mode)
    @behavior ||= self.behavior
    @behavior.time += self.delay.time_ps
    if @sim.multithread then
        # Multi thread mode: synchronize.
        # puts "Stopping #{@behavior.object_id} (@behavior.time=#{@behavior.time})..."
        @sim.run_done(@behavior.id)
        # puts "Rerunning #{@behavior.object_id} (@behavior.time=#{@behavior.time})..."
        @sim.run_req(@behavior.id)
    else
        # No thread mode, need to advance the global simulator.
        @sim.advance
    end
end

#get_vars_with_fullname(vars_with_fullname = {}) ⇒ Object

Gets the VCD variables with their long name.



289
290
291
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 289

def get_vars_with_fullname(vars_with_fullname = {})
    # By default: nothing to do
end

#get_vars_with_idstr(vars_with_idstr = {}) ⇒ Object

Gets the VCD variables with their id string.



294
295
296
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 294

def get_vars_with_idstr(vars_with_idstr = {})
    # By default: nothing to do
end

#init_sim(systemT) ⇒ Object

Initialize the simulation for system +systemT+.



745
746
747
# File 'lib/HDLRuby/hruby_rsim.rb', line 745

def init_sim(systemT)
    @sim = systemT
end

#show_hierarchy(vcdout) ⇒ Object

Shows the hierarchy of the variables.



284
285
286
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 284

def show_hierarchy(vcdout)
    # By default: nothing to do.
end

#to_lowObject

Converts the wait statement to HDLRuby::Low.



2667
2668
2669
2670
2671
2672
2673
2674
# File 'lib/HDLRuby/hruby_high.rb', line 2667

def to_low
    # return HDLRuby::Low::TimeWait.new(self.delay.to_low)
    timeWaitL = HDLRuby::Low::TimeWait.new(self.delay.to_low)
    # # For debugging: set the source high object 
    # timeWaitL.properties[:low2high] = self.hdr_id
    # self.properties[:high2low] = timeWaitL
    return timeWaitL
end

#to_rcsimObject

Generate the C description of the time wait.



644
645
646
647
648
649
650
# File 'lib/HDLRuby/hruby_rcsim.rb', line 644

def to_rcsim
    # Create the time wait C object.
    @rcstatement = RCSim.rcsim_make_timeWait(self.delay.unit,
                                       self.delay.value.to_i)

    return @rcstatement
end