class ClassHDL::HDLAssignBlock

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_assign.rb, line 8
def initialize(belong_to_module)
    @opertor_chains = []
    @belong_to_module = belong_to_module
    unless @belong_to_module 
        raise TdlError.new("HDLAssignBlock must have belong_to_module")
    end
end

Public Instance Methods

instance() click to toggle source
# File lib/tdl/class_hdl/hdl_assign.rb, line 16
def instance
    unless @belong_to_module.is_a?(SdlModule) 
        raise TdlError.new("HDLAssignBlock must have belong_to_module")
    end
    str = []
    opertor_chains.each do |op|
        
        unless op.slaver
            sub_str = op.instance(:assign,belong_to_module)
            # if sub_str =~ /^(?<head>[\w\.\[\]\:]+\s*)(?<eq><?=\s*)\((?<body>.+)\)$/
            #     rel_str = $~[:head] + $~[:eq] + $~[:body]
            # else
            #     rel_str = sub_str
            # end
            rel_str = ClassHDL.compact_op_ch(sub_str)
            str << "assign " + rel_str + ";\n"
        end
    end
    str.join("")
end