Class: ClassHDL::HDLAlwaysBlock
- Inherits:
-
Object
- Object
- ClassHDL::HDLAlwaysBlock
- Defined in:
- lib/tdl/class_hdl/hdl_always_ff.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#belong_to_module ⇒ Object
readonly
Returns the value of attribute belong_to_module.
-
#negedges ⇒ Object
Returns the value of attribute negedges.
-
#opertor_chains ⇒ Object
Returns the value of attribute opertor_chains.
-
#posedges ⇒ Object
Returns the value of attribute posedges.
Instance Method Summary collapse
- #edge_instance(flag = 'posedge', edges = []) ⇒ Object
-
#initialize(belong_to_module) ⇒ HDLAlwaysBlock
constructor
A new instance of HDLAlwaysBlock.
- #instance ⇒ Object
Constructor Details
#initialize(belong_to_module) ⇒ HDLAlwaysBlock
Returns a new instance of HDLAlwaysBlock.
36 37 38 39 40 41 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 36 def initialize(belong_to_module) @opertor_chains = [] @posedges = [] @negedges = [] @belong_to_module = belong_to_module end |
Instance Attribute Details
#belong_to_module ⇒ Object (readonly)
Returns the value of attribute belong_to_module.
35 36 37 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 35 def belong_to_module @belong_to_module end |
#negedges ⇒ Object
Returns the value of attribute negedges.
34 35 36 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 34 def negedges @negedges end |
#opertor_chains ⇒ Object
Returns the value of attribute opertor_chains.
34 35 36 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 34 def opertor_chains @opertor_chains end |
#posedges ⇒ Object
Returns the value of attribute posedges.
34 35 36 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 34 def posedges @posedges end |
Instance Method Details
#edge_instance(flag = 'posedge', edges = []) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 43 def edge_instance(flag='posedge',edges=[]) unless edges.is_a? Array es = [edges] else es = edges end es.compact! return es.map{|e| "#{flag} #{e.to_s}"} end |
#instance ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/tdl/class_hdl/hdl_always_ff.rb', line 53 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(:always_ff).gsub(/^./){ |m| " #{m}"} else unless op.slaver rel_str = ClassHDL.compact_op_ch(op.instance(:always_ff, belong_to_module)) str.push " #{rel_str};" end end end str.push "end\n" str.join("\n") end |