class ClassHDL::HDLInitialBlock

Attributes

belong_to_module[R]
opertor_chains[RW]

Public Class Methods

new(belong_to_module) click to toggle source
# File lib/tdl/class_hdl/hdl_initial.rb, line 7
def initialize(belong_to_module)
    @opertor_chains = []
    @belong_to_module = belong_to_module
    unless @belong_to_module 
        raise TdlError.new("HDLInitialBlock must have belong_to_module")
    end
end

Public Instance Methods

instance(block_name=nil) click to toggle source
# File lib/tdl/class_hdl/hdl_initial.rb, line 15
def instance(block_name=nil)
    str = []
    str.push "initial begin#{block_name ? ':'.concat(block_name.to_s) : ''}"
    opertor_chains.each do |op|
        unless op.is_a? OpertorChain
            str.push op.instance(:assign).gsub(/^./){ |m| "    #{m}"}
        else 
            unless op.slaver
                rel_str = ClassHDL.compact_op_ch(op.instance(:assign, belong_to_module))
                str.push "    #{rel_str};"
            end
        end
        
    end
    str.push "end\n"
    str.join("\n")
end
instance_inspect() click to toggle source
# File lib/tdl/class_hdl/hdl_initial.rb, line 33
def instance_inspect()
    str = []
    block_name=nil
    str.push "initial begin#{block_name ? ':'.concat(block_name.to_s) : ''}"
    opertor_chains.each do |op|
        unless op.is_a? OpertorChain
            str.push op.instance(:assign).gsub(/^./){ |m| "    #{m}"}
        else 
            unless op.slaver
                rel_str = ClassHDL.compact_op_ch(op.instance(:assign,belong_to_module))
                str.push "    #{rel_str};"
            end
        end
        
    end
    str.push "end\n"
    str.join("\n")
end