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 HDLAlwaysFFBlock

#negedges, #opertor_chains, #posedges

Instance Method Summary collapse

Methods inherited from HDLAlwaysFFBlock

#edge_instance, #initialize

Constructor Details

This class inherits a constructor from ClassHDL::HDLAlwaysFFBlock

Instance Method Details

#instanceObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 94

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))
                str.push "    #{rel_str};"
            end
        end
        
    end
    str.push "end\n"
    str.join("\n")
end