Class: Reset
- Includes:
- BaseModule, ClassHDL::AssignDefOpertor
- Defined in:
- lib/tdl/elements/Reset.rb,
lib/tdl/class_hdl/hdl_redefine_opertor.rb
Overview
require_relative “./tdlerror” require_relative “./basefunc”
Constant Summary
Constants included from ClassHDL::AssignDefOpertor
ClassHDL::AssignDefOpertor::OP_SYMBOLS
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#dsize ⇒ Object
Returns the value of attribute dsize.
-
#ghost ⇒ Object
Returns the value of attribute ghost.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
Attributes inherited from BaseElm
Class Method Summary collapse
-
.parse_ports(port_str) ⇒ Object
parse text for autogen method and constant ###.
Instance Method Summary collapse
- #high_signal ⇒ Object
-
#initialize(name: "system_rst", active: "LOW", port: false, dsize: 1) ⇒ Reset
constructor
A new instance of Reset.
-
#inst_port ⇒ Object
def port_length (@port.to_s + “ ”).length end.
-
#low_signal ⇒ Object
def left_port_length (“/* input” + “ */ ”).length end.
Methods included from ClassHDL::AssignDefOpertor
curr_assign_block, curr_assign_block=, curr_assign_block_stack, curr_opertor_stack, included, init_op_methods, use_new_yield_opertors, use_old_cond_opertors, with_new_assign_block, with_new_opertor, with_normal_opertor, with_rollback_opertors
Methods included from BaseModule
Methods inherited from SignalElm
#[], inherited, #inst, subclass
Methods inherited from BaseElm
#matrix, #name_copy, #path_refs, recfg_nc, #s, #signal
Methods included from TdlSpace::ExCreateTP
Constructor Details
#initialize(name: "system_rst", active: "LOW", port: false, dsize: 1) ⇒ Reset
Returns a new instance of Reset.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tdl/elements/Reset.rb', line 8 def initialize(name:"system_rst",active:"LOW",port:false,dsize:1) name_legal?(name) # @id = GlobalParam.CurrTdlModule.BindEleClassVars.Reset.id @dsize = dsize @name = name @port = port @active = active.to_s.downcase if @active.eql?("low") && @active.eql?("high") raise TdlError.new("RESET ACTIVE PARA #{@active} ERROR") end # if @port # GlobalParam.CurrTdlModule.BindEleClassVars.Reset.ports << self if @id != 0 # else # GlobalParam.CurrTdlModule.BindEleClassVars.Reset.inst_stack << method(:inst).to_proc # end # if @id == 2 # raise TdlError.new("____________") # end end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
5 6 7 |
# File 'lib/tdl/elements/Reset.rb', line 5 def active @active end |
#dsize ⇒ Object
Returns the value of attribute dsize.
6 7 8 |
# File 'lib/tdl/elements/Reset.rb', line 6 def dsize @dsize end |
#ghost ⇒ Object
Returns the value of attribute ghost.
6 7 8 |
# File 'lib/tdl/elements/Reset.rb', line 6 def ghost @ghost end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/tdl/elements/Reset.rb', line 6 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/tdl/elements/Reset.rb', line 5 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/tdl/elements/Reset.rb', line 6 def port @port end |
Class Method Details
.parse_ports(port_str) ⇒ Object
parse text for autogen method and constant ###
146 147 148 149 150 |
# File 'lib/tdl/elements/Reset.rb', line 146 def self.parse_ports(port_str) rh = super.parse_ports(port_str) rh[:type] = Reset return rh end |
Instance Method Details
#high_signal ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/tdl/elements/Reset.rb', line 93 def high_signal if(active.eql? "low") NqString.new("~").concat signal else signal end end |
#inst_port ⇒ Object
def port_length
(@port.to_s + " ").length
end
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tdl/elements/Reset.rb', line 44 def inst_port # if @port # (@port.to_s + " " + " "*sub_len + @name.to_s) # end if dsize.eql? 1 n = "" else n = "[#{(@dsize-1)}:0]" end return [@port.to_s+n,@name.to_s,""] end |
#low_signal ⇒ Object
def left_port_length
("/* input" + " */ ").length
end
def right_port_length
(".#{@name.to_s} ").length
end
def ex_port(left_align_len = 7,right_align_len = 7)
if left_align_len >= left_port_length
sub_left_len = left_align_len - left_port_length
else
sub_left_len = 0
end
if right_align_len >= right_port_length
sub_right_len = right_align_len - right_port_length
else
sub_right_len = 0
end
if @port
("/* input" + " "*sub_left_len + "*/ " + "."+@name.to_s + " "*sub_right_len)
end
end
85 86 87 88 89 90 91 |
# File 'lib/tdl/elements/Reset.rb', line 85 def low_signal if(active.eql? "low") signal else NqString.new("~").concat signal end end |