Class: ClassHDL::HDLAlwaysSIMBlock

Inherits:
HDLAlwaysFFBlock show all
Defined in:
lib/tdl/class_hdl/hdl_always_ff.rb

Overview

添加测试用always

Instance Attribute Summary

Attributes inherited from HDLAlwaysBlock

#belong_to_module, #negedges, #opertor_chains, #posedges

Instance Method Summary collapse

Methods inherited from HDLAlwaysBlock

#edge_instance, #initialize

Constructor Details

This class inherits a constructor from ClassHDL::HDLAlwaysBlock

Instance Method Details

#instanceObject



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 133

def instance
    str = []

    pose_str = edge_instance('posedge',@posedges)
    nege_str = edge_instance('negedge',@negedges)
    pose_str.concat nege_str

    str.push "always@(#{pose_str.join(",")}) begin "
    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