Class: ClassHDL::HDLAssignBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/class_hdl/hdl_assign.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(belong_to_module) ⇒ HDLAssignBlock

Returns a new instance of HDLAssignBlock.



8
9
10
11
12
13
14
# 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

Instance Attribute Details

#belong_to_moduleObject (readonly)

Returns the value of attribute belong_to_module.



6
7
8
# File 'lib/tdl/class_hdl/hdl_assign.rb', line 6

def belong_to_module
  @belong_to_module
end

#opertor_chainsObject

Returns the value of attribute opertor_chains.



5
6
7
# File 'lib/tdl/class_hdl/hdl_assign.rb', line 5

def opertor_chains
  @opertor_chains
end

Instance Method Details

#instanceObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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