Class: CommonCFGReg

Inherits:
InfElm show all
Extended by:
BaseFunc
Includes:
BaseModule
Defined in:
lib/tdl/elements/common_configure_reg.rb,
lib/tdl/elements/common_configure_reg.rb

Overview

signals in interface

Instance Attribute Summary collapse

Attributes inherited from InfElm

#dimension

Attributes inherited from BaseElm

#belong_to_module

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseFunc

check_same, check_same_class, check_same_clock, check_same_dsize

Methods included from BaseModule

#length, #to_s

Methods inherited from InfElm

#[], #dimension_num, #draw, inherited, #port_length, same_name_socket, #signal, subclass

Methods inherited from BaseElm

#matrix, #name_copy, #path_refs, recfg_nc, #s, #signal

Methods included from TdlSpace::ExCreateTP

#root_ref

Methods included from AxiTdl::TestUnitTrack

#tracked_by_dve

Constructor Details

#initialize(name: "cfg_inf", dsize: 8, asize: 8, port: false, dimension: []) ⇒ CommonCFGReg

Returns a new instance of CommonCFGReg.



6
7
8
9
10
11
12
13
# File 'lib/tdl/elements/common_configure_reg.rb', line 6

def initialize(name:"cfg_inf",dsize:8,asize:8,port:false,dimension:[])
    name_legal?(name)
    super(dimension:dimension)
    @port = port
    @dsize = dsize
    @name = name
    @asize = asize
end

Instance Attribute Details

#asizeObject

Returns the value of attribute asize.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def asize
  @asize
end

#dsizeObject

Returns the value of attribute dsize.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def dsize
  @dsize
end

#ghostObject

Returns the value of attribute ghost.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def ghost
  @ghost
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def name
  @name
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/tdl/elements/common_configure_reg.rb', line 5

def port
  @port
end

Class Method Details

.parse_ports(port_array = nil) ⇒ Object

SV FILE PORT PARSE



29
30
31
32
33
34
35
36
37
# File 'lib/tdl/elements/common_configure_reg.rb', line 29

def self.parse_ports(port_array=nil)
    rep = /(?<up_down>\(\*\s+(?<ud_name>stream_up|stream_down)\s*=\s*"true"\s+\*\))?\s*(common_configure_reg_interface\.)(?<modport>master|slaver)\s+(?<name>\w+)\s*(?<vector>\[.*?\])?/m
    up_stream_rep = /stream_up/

    InfElm.parse_ports(port_array,rep,"common_configure_reg_interface",up_stream_rep) do |h|
        h[:type] = CommonCFGReg
        yield h
    end
end

.sdlinst_t0(ele) ⇒ Object

SdlInst



41
42
43
44
45
46
47
# File 'lib/tdl/elements/common_configure_reg.rb', line 41

def self.sdlinst_t0(ele)
    if ele.class ==  CommonCFGReg then
        "common_configure_reg_interface.#{ele.port}"
    else
        nil
    end
end

Instance Method Details

#__inf_signal__(name, index = 0) ⇒ Object



54
55
56
57
# File 'lib/tdl/elements/common_configure_reg.rb', line 54

def __inf_signal__(name,index=0)
    NqString.new(signal(index).concat ".#{name}")
    # signal.concat ".#{name}"
end

#__inf_signal_list_(lname, index = 0, h = nil, l = nil) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/tdl/elements/common_configure_reg.rb', line 75

def __inf_signal_list_(lname,index=0,h=nil,l=nil)

    if h.is_a? Range
        l = h.to_a.min
        h = h.to_a.max
    end

    if h
        if l
            sqr = "[#{h.to_s}:#{l.to_s}]"
        else
            sqr = "[#{h.to_s}]"
        end
    else
        sqr = ""
    end
    NqString.new(signal(index).concat(".#{lname}").concat(sqr))
end

#instObject



15
16
17
18
19
20
21
# File 'lib/tdl/elements/common_configure_reg.rb', line 15

def inst
    return "" if @ghost || @port
"common_configure_reg_interface #(
.ASIZE  (#{asize}),
.DSIZE  (#{dsize})
)#{signal} #{array_inst} ();"
end

#inst_portObject



23
24
25
# File 'lib/tdl/elements/common_configure_reg.rb', line 23

def inst_port
    return ["common_configure_reg_interface." + @port.to_s,@name.to_s,array_inst]
end