Class: HDLRuby::High::Print

Inherits:
Low::Print 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 Print class with VCD support.

Constant Summary collapse

High =
HDLRuby::High

Constants included from Low::Low2Symbol

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

Instance Attribute Summary collapse

Attributes included from Low::Hparent

#parent

Instance Method Summary collapse

Methods included from HStatement

#hif

Methods inherited from Low::Print

#boolean_in_assign2select!, #casts_without_expression!, #clone, #delete_arg!, #each_arg, #each_block, #each_block_deep, #each_deep, #each_node, #each_node_deep, #each_statement_deep, #eql?, #explicit_types!, #extract_selects!, #hash, #map_args!, #replace_args!, #to_c, #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

#initialize(*args) ⇒ Print

Creates a new statement for printing +args+.



3661
3662
3663
3664
# File 'lib/HDLRuby/hruby_high.rb', line 3661

def initialize(*args)
    # Process the arguments.
    super(*args.map(&:to_expr))
end

Instance Attribute Details

#rcstatementObject (readonly)

Returns the value of attribute rcstatement.



535
536
537
# File 'lib/HDLRuby/hruby_rcsim.rb', line 535

def rcstatement
  @rcstatement
end

Instance Method Details

#execute(mode) ⇒ Object

Executes the statement.



717
718
719
720
721
722
723
724
725
726
727
728
729
730
# File 'lib/HDLRuby/hruby_rsim.rb', line 717

def execute(mode)
    self.each_arg.map do |arg|
        case arg
        when StringE
            @sim.show_string(arg.content)
        when SignalI
            @sim.show_signal(arg)
        when SignalC
            @sim.show_signal(arg)
        else
            @sim.show_value(arg.execute(mode))
        end
    end
end

#get_vars_with_fullname(vars_with_fullname = {}) ⇒ Object

Gets the VCD variables with their long name.



308
309
310
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 308

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.



313
314
315
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 313

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

#init_sim(systemT) ⇒ Object

Initialize the simulation for system +systemT+.



712
713
714
# File 'lib/HDLRuby/hruby_rsim.rb', line 712

def init_sim(systemT)
    @sim = systemT
end

#show_hierarchy(vcdout) ⇒ Object

Shows the hierarchy of the variables.



303
304
305
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 303

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

#to_lowObject

Converts the connection to HDLRuby::Low.



3667
3668
3669
# File 'lib/HDLRuby/hruby_high.rb', line 3667

def to_low
    return HDLRuby::Low::Print.new(*self.each_arg.map(&:to_low))
end

#to_rcsimObject

Generate the C description of the print.



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
# File 'lib/HDLRuby/hruby_rcsim.rb', line 538

def to_rcsim
    # Create the print C object.
    @rcstatement = RCSim.rcsim_make_print()

    # Adds the arguments.
    # self.each_arg do |arg|
    #     RCSim.rcsim_add_print_arg(@rcstatement,arg.to_rcsim)
    # end
    if self.each_arg.any? then
        RCSim.rcsim_add_print_args(@rcstatement,
                                   self.each_arg.map(&:to_rcsim))
    end

    return @rcstatement
end