Top Level Namespace
Defined Under Namespace
Modules: AxiTdl, BaseFunc, BaseModule, ClassHDL, CtrlLogic, HDLClass, ItegrationAttr, RedefOpertor, TdlSimTest, TdlSpace, VCSCompatable
Classes: ABlock, AutoGenSdl, AutoGenTdl, Axi4, Axi4IllegalBFM, AxiLite, AxiStream, AxiStreamBFMModuleBuild, AxiStreamBFMParse, BaseElm, BfmStream, CLKInfElm, CMRamInf, Clock, ClockITest, ClockManage, CommCfgReg, CommonCFGReg, Constraints, ConstraintsVerb, DataInf, DataInf_C, DebugLogic, DefXp, DefaultProc, DiffClockITest, EXParam, ElementClassVars, EmptyModule, GenBlockModule, GenInnerStr, GlobalParam, IOITest, InfElm, InfPort, Integer, IntegralTest, Itegration, ItegrationVerb, ItegrationVerbAgent, ItgApi, ItgtArray, Logic, MailBox, NameSPoolHash, NqString, Numeric, PackClassVars, Parameter, Parser, Reset, ResetITest, SdlImplModule, SdlImplParam, SdlInst, SdlInstPortSugar, SdlInstSimplePortSugar, SdlModule, SdlTopImplement, SignalElm, SimpleLogicITest, String, StringBandItegration, Symbol, TBConnnectEle, Tdl, TdlBuild, TdlError, TdlPackage, TdlTest, TdlTestUnit, TechBench, TechBenchModule, TestArrayChain, TestAxiStream, TestModule, TestUnitModule, TopModule, TrackInf, TryDefXp, VideoInf
Instance Method Summary
collapse
-
#add_to_tdl_paths(full_path) ⇒ Object
-
#align_signal(obj, q_mark = true) ⇒ Object
-
#axis_gen_big_field(mode: "MASTER", value: "32'h00000", enable: "1'b1", dsize: 8, clock: nil, reset: nil, copy_axis: nil) ⇒ Object
-
#check_same_name_method(name) ⇒ Object
-
#compact_signal(obj, q_mark = false) ⇒ Object
-
#define_main_func(name, &block) ⇒ Object
-
#exist_same_name_sdl(e) ⇒ Object
-
#find_first_hdl_path(basename) ⇒ Object
-
#freeze_tdl_name_large_len ⇒ Object
-
#globle_random_name_flag(flag = 'R') ⇒ Object
-
#large_name_len(*c) ⇒ Object
def String.align_signal().
-
#Logic(name, dsize: 1, dimension: [], assign: nil) ⇒ Object
-
#look_for_v(path) ⇒ Object
-
#mark_files(file_list) ⇒ Object
-
#page(tag: "TAG EXP", body: "") ⇒ Object
-
#pagination(tag = "") ⇒ Object
-
#path_scan(path, rep = /.sv/i) ⇒ Object
require_relative “./autogenaxis” require_relative “./autogentdl”.
-
#replace_methods(class_obj, methods_hash) ⇒ Object
-
#require_axi4path(a) ⇒ Object
-
#require_hdl(hdl_path) ⇒ Object
-
#require_path(path) ⇒ Object
def gen_auto_files(file_hash) axi_stream_path = “./axi_stream”.
-
#require_path_and_ignore(path, *ignores) ⇒ Object
-
#require_relative_path(relative = File.expand_path(__dir__), path) ⇒ Object
mark_files(path_scan(‘E:workAXIAXI_stream’)).each {|e| puts e} unless ARGV.empty? gen_auto_files(mark_files(path_scan(‘E:workAXIAXI_stream’))) end.
-
#require_sdl(sdl_path) ⇒ Object
-
#rollback_methods(class_obj, *methods_nams) ⇒ Object
-
#stand(path) ⇒ Object
-
#sw_always(to = "xilinx", file_name) ⇒ Object
-
#tdl_name_large_len ⇒ Object
-
#test0 ⇒ Object
-
#test_inner_inst ⇒ Object
-
#undefine_main_func(name) ⇒ Object
-
#unfreeze_tdl_name_large_len ⇒ Object
-
#update_tdl_name_large_len(a) ⇒ Object
-
#with_main_funcs(func_hash, &block) ⇒ Object
-
#with_new_align(num = 0, &block) ⇒ Object
Instance Method Details
#add_to_tdl_paths(full_path) ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/tdl/global_scan.rb', line 124
def add_to_tdl_paths(full_path)
if File.exist? full_path
unless File.directory? full_path
raise "<#{full_path}> is not a directory!!!"
else
$__tdl_paths__ << full_path unless $__tdl_paths__.include?(full_path)
end
else
raise "Dont exist #{full_path}"
end
end
|
#align_signal(obj, q_mark = true) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/tdl/basefunc.rb', line 127
def align_signal(obj,q_mark=true)
raise TdlError.new("align_signal OBJECT CANT BE ARRAY LEN[#{obj.size}] [#{obj}]") if obj.is_a? Array
if obj.is_a? NqString
new_obj = obj
elsif obj.is_a? Proc
new_obj = obj.call
elsif obj.instance_of? String
if obj.match(/\d*'(d|h|b|sd|sh|sb)(\d|z|x)+/i) || obj.match(/'(0|1|z|x)/ || obj.match(/^\d+$/))
new_obj = obj
else
if q_mark
new_obj = '"'+obj+'"'
else
new_obj = obj
end
end
else
new_obj = obj
end
sl = new_obj.to_s.length
if block_given?
yield(tdl_name_large_len,sl)
end
if tdl_name_large_len>=sl
ll = tdl_name_large_len-sl
else
ll=0
end
rel = new_obj.to_s + " "*ll
rel
end
|
#axis_gen_big_field(mode: "MASTER", value: "32'h00000", enable: "1'b1", dsize: 8, clock: nil, reset: nil, copy_axis: nil) ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/tdl/basefunc.rb', line 22
def axis_gen_big_field(mode:"MASTER",value:"32'h00000",enable:"1'b1",dsize:8,clock:nil,reset:nil,copy_axis:nil)
if copy_axis.is_a? AxiStream
new_axis = AxiStream.new(name:"orign_axis",clock:copy_axis.clock,reset:copy_axis.reset,dsize:copy_axis.dsize)
else
new_axis = AxiStream.new(name:"orign_axis",clock:clock,reset:reset,dsize:dsize)
end
new_axis.gen_big_field(mode:mode,value:value,enable:enable)
end
|
#check_same_name_method(name) ⇒ Object
3
4
5
|
# File 'lib/tdl/Logic/logic_main.rb', line 3
def check_same_name_method(name)
raise TdlError.new("\n 'Method' Name Error ,#{name} Can't be defined,because it has same name\n") if self.methods.include? name.to_sym
end
|
#compact_signal(obj, q_mark = false) ⇒ Object
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'lib/tdl/basefunc.rb', line 180
def compact_signal(obj,q_mark=false)
if obj.is_a? String
if obj.match(/\d*'(d|h|b|sd|sh|sb)(\d|z|x)+/i) || obj.match(/'(0|1|z|x)/ || obj.match(/^\d+$/))
new_obj = obj
else
if q_mark
new_obj = '"'+obj+'"'
else
new_obj = obj
end
end
else
new_obj = obj
end
new_obj.to_s
end
|
#define_main_func(name, &block) ⇒ Object
275
276
277
278
279
|
# File 'lib/tdl/basefunc.rb', line 275
def define_main_func(name,&block)
raise TdlError.new("\n In define main Function: function name <<#{name}>> must Symbol\n") unless name.is_a? Symbol
raise TdlError.new("\n Function <<#{name}>>has already be defined in MAIN \n") if $__main__.methods.include?(name)
$__main__.send(:define_method,name,&block)
end
|
#exist_same_name_sdl(e) ⇒ Object
20
21
22
23
|
# File 'lib/tdl/auto_script/test_autogensdl.rb', line 20
def exist_same_name_sdl(e)
sdl_file = e.sub(/\.sv$/,".rb")
File.exist? sdl_file
end
|
#find_first_hdl_path(basename) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/tdl/auto_script/import_hdl.rb', line 28
def find_first_hdl_path(basename)
$__tdl_paths__.each do |e|
if File.exist? File.join(e,basename)
return File.join(e,basename)
end
end
return nil
end
|
#freeze_tdl_name_large_len ⇒ Object
14
15
16
|
# File 'lib/tdl/basefunc.rb', line 14
def freeze_tdl_name_large_len
$__tdl_name_large_len_freeze_en = true
end
|
#globle_random_name_flag(flag = 'R') ⇒ Object
335
336
337
338
339
|
# File 'lib/tdl/basefunc.rb', line 335
def globle_random_name_flag(flag='R')
rel = $__name_random_index__[$__name_random_index_ii__]
$__name_random_index_ii__ += 1
"#{flag}#{rel}"
end
|
#large_name_len(*c) ⇒ Object
def String.align_signal()
#Logic(name, dsize: 1, dimension: [], assign: nil) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/tdl/elements/logic.rb', line 7
def Logic(name,dsize:1,dimension:[],assign:nil)
a = Logic.new(name:name,dsize:dsize,dimension:dimension)
$__tdl_cur_self__.send(:define_method,name) { a }
if assign
Assign { a <= assign }
end
nil
end
|
#look_for_v(path) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/public_atom_module/altera_xilinx_always_block_sw.rb', line 28
def look_for_v(path)
paths = Dir::entries(path) - %w{. ..}
paths.each do |pf|
full_name = File.join(path,pf)
if(File.directory? full_name)
look_for_v(full_name)
elsif(File.file? full_name)
if(/\.v$/i =~ pf || /\.sv$/i =~ pf)
sw_always($mode,full_name)
end
end
end
end
|
#mark_files(file_list) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/tdl/global_scan.rb', line 25
def mark_files(file_list)
file_hash = Hash.new
file_list.each do |e|
f_str = File.open(e,'r').read.force_encoding('utf-8')
mth = f_str.match(/\(\*\s+(?<inf>axi_stream|axi4|data_inf|axi_lite)\s*=\s*"true"\s+\*\)/)
next unless (mth)
sub_hash = Hash.new
hash_name = File::basename(e,".*")
sub_hash[:name] = File::basename(e,".*")
sub_hash[:path] = e
sub_hash[:mtime]= File::mtime(e)
sub_hash[:inf] = mth[:inf]
file_hash[hash_name] = sub_hash
end
return file_hash
end
|
#page(tag: "TAG EXP", body: "") ⇒ Object
56
57
58
59
60
61
62
63
|
# File 'lib/tdl/basefunc.rb', line 56
def page(tag:"TAG EXP",body:"")
return "" if body.empty?
end_str =
"\n//====>>>> #{tag} <<<<#{"="*(60-tag.length)}\n"
head_str =
"//----<<<< #{tag} >>>>#{"-"*(60-tag.length)}\n"
return head_str + body.strip + end_str
end
|
65
66
67
68
69
70
|
# File 'lib/tdl/basefunc.rb', line 65
def (tag="")
return "" if tag.empty?
head_str = "\n//==============#{"="*(60-0)}"
end_str = "\n//-------- #{tag} ----#{"-"*(60-tag.length)}\n"
head_str.concat end_str
end
|
#path_scan(path, rep = /.sv/i) ⇒ Object
require_relative “./autogenaxis” require_relative “./autogentdl”
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/tdl/global_scan.rb', line 4
def path_scan(path,rep=/.sv/i)
root_path = path
dir_list = Dir::entries(path) - %w{. ..}
dir_list.select! {|d| d !~ /^\./}
dir_list.map! {|d| File::join(root_path,d)}
file_list = dir_list.select do |d|
(File::file? d) && (d =~ rep)
end
dir_list = dir_list - file_list
dir_list.select! {|d| File.directory? d}
dir_cel = dir_list.map do |e|
path_scan(e,rep)
end
return file_list + dir_cel.flatten
end
|
#replace_methods(class_obj, methods_hash) ⇒ Object
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# File 'lib/tdl/basefunc.rb', line 303
def replace_methods(class_obj,methods_hash)
methods_hash.each do |key,proc|
if class_obj.instance_methods.include?(key.to_s.to_sym)
class_obj.alias_method "replace__m_old_#{key.to_s}",key.to_s
end
class_obj.define_method(key,&proc)
end
end
|
#require_axi4path(a) ⇒ Object
163
164
165
|
# File 'lib/tdl/tdl.rb', line 163
def require_axi4path(a)
require_relative File.join(Tdl.Axi4Path,a)
end
|
#require_hdl(hdl_path) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/tdl/auto_script/import_hdl.rb', line 2
def require_hdl(hdl_path)
basename = File.basename(hdl_path,".sv")
unless SdlModule.exist_module? basename
if File.exist? hdl_path
AutoGenSdl.new(hdl_path,File.join(__dir__,"tmp")).auto_rb
else
if hdl_path !~ /[\/|\\]/
rel = find_first_hdl_path(hdl_path)
unless rel
raise TdlError.new("Cant find <#{hdl_path}> in tdl paths !!!")
end
AutoGenSdl.new(rel,File.join(__dir__,"tmp")).auto_rb
else
raise TdlError.new("path<#{hdl_path}> error!!!")
end
end
require_relative File.join(__dir__,"tmp","#{basename}_sdl.rb")
end
end
|
#require_path(path) ⇒ Object
def gen_auto_files(file_hash)
axi_stream_path = "./axi_stream"
file_hash.each do |key,value|
auto_axi_stream(filename=value[:path],out_file_path=axi_stream_path)
end
end
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/tdl/global_scan.rb', line 51
def require_path(path)
curr_path = File.expand_path(path)
file_list = path_scan(curr_path,/\.rb$/)
mark_list = file_list.map { |e| e.sub(/\.rb$/,"_auto.rb") }
mark_list = mark_list.select { |e| e !~ /_auto_auto/}
mark_sdl = file_list.map { |e| e.sub(/\.rb$/,"_sdl.rb") }
mark_sdl = mark_sdl.select { |e| e !~ /_sdl_sdl/}
mark_bak = file_list.select { |e| e =~ /\Wbak\W/i}
file_list = file_list - mark_list - mark_bak - mark_sdl
file_list = file_list - mark_list.select { |e| e.sub(/^_+/,"") }
file_list = file_list.select { |e| e !~ /^test/i}
file_list.each do |e|
require_relative (''+e.sub(/\.rb/,'')+'')
end
return file_list
end
|
#require_path_and_ignore(path, *ignores) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/tdl/global_scan.rb', line 80
def require_path_and_ignore(path,*ignores)
curr_path = File.expand_path(path)
file_list = path_scan(curr_path,/\.rb$/)
mark_list = file_list.map { |e| e.sub(/\.rb$/,"_auto.rb") }
mark_list = mark_list.select { |e| e !~ /_auto_auto/}
file_list = file_list - mark_list
file_list = file_list - mark_list.select { |e| e.sub(/^_+/,"") }
file_list = file_list.select { |e| e !~ /^test/i}
file_list = file_list.select do |e|
get_l = true
ignores.each do |ig|
if e.include? ig
get_l = false
end
end
get_l
end
file_list.each do |e|
require_relative (''+e.sub(/\.rb/,'')+'')
end
end
|
#require_relative_path(relative = File.expand_path(__dir__), path) ⇒ Object
mark_files(path_scan(‘E:workAXIAXI_stream’)).each {|e| puts e} unless ARGV.empty?
gen_auto_files(mark_files(path_scan('E:\work\AXI\AXI_stream')))
end
117
118
119
|
# File 'lib/tdl/global_scan.rb', line 117
def require_relative_path(relative=File.expand_path(__dir__),path)
require_path(File.expand_path(File.join(relative,path)))
end
|
#require_sdl(sdl_path) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/tdl/auto_script/import_sdl.rb', line 3
def require_sdl(sdl_path)
basename = File.basename(sdl_path,".rb")
unless SdlModule.exist_module? basename
if File.exist? sdl_path
require_relative File.expand_path(sdl_path)
else
if sdl_path !~ /[\/|\\]/
rel = find_first_hdl_path(sdl_path)
unless rel
raise TdlError.new("Can find <#{sdl_path}> in tdl paths !!!")
end
require_relative rel
else
raise TdlError.new("path<#{sdl_path}> error!!!")
end
end
end
end
|
#rollback_methods(class_obj, *methods_nams) ⇒ Object
319
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/tdl/basefunc.rb', line 319
def rollback_methods(class_obj,*methods_nams)
methods_nams.each do |key|
if class_obj.instance_methods.include?("replace__m_old_#{key.to_s}".to_sym)
class_obj.class_exec(key) do |key|
alias_method key.to_s,"replace__m_old_#{key.to_s}"
end
else
class_obj.undef_method(key.to_s)
end
end
end
|
#stand(path) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/axi/macro/bak/standard_tcl.rb', line 11
def stand(path)
all_str = File.open(path,'r'){ |f| f.read }
all_str.gsub!(/\\\s*$/,'>>>>')
all_str.gsub!("\n","[NNNNN]")
all_str.gsub!("\r","[RRRRR]")
all_str.gsub!("\\","/")
all_str.gsub!('>>>>',"\\")
all_str.gsub!(/\\\s*$/,"\n")
all_str.gsub!("[NNNNN]","\n")
all_str.gsub!("[RRRRR]","\r")
return all_str
end
|
#sw_always(to = "xilinx", file_name) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/public_atom_module/altera_xilinx_always_block_sw.rb', line 4
def sw_always(to="xilinx",file_name)
all_str = File.open(file_name).read
altera_rep_0 = /always\s*@\s*\(\s*posedge\s+(?<clock_name>\w*(?i:clock|clk)\w*)\s*(?:,|or)\s*negedge\s+(?<rst_name>\w*(?:rst|reset)\w*)\s*\)/
xilinx_rep = /always\s*@\s*\(posedge\s+(?<clock_name>\w*(?i:clock|clk)\w*)\s*\/\*.+\*\/\s*\)/
if(to.downcase=="xilinx")
all_str.gsub!(altera_rep_0) do |s|
"always@(posedge #{$~["clock_name"]}/*,negedge #{$~["rst_name"]}*/)"
end
elsif to.downcase=="altera"
all_str.gsub!(xilinx_rep) do |s|
s.sub('/*','').sub('*/','')
end
end
File.open(file_name,"w"){|f| f.print(all_str)}
end
|
#tdl_name_large_len ⇒ Object
5
6
7
|
# File 'lib/tdl/basefunc.rb', line 5
def tdl_name_large_len
$__tdl_name_large_len
end
|
#test0 ⇒ Object
801
802
803
804
805
806
807
808
|
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 801
def test0
as = TestAxiStream.new
as.modport_type = 'master'
as.dimension = [9,4]
as.inst_name = "dt_inf"
puts as.instance
end
|
#test_inner_inst ⇒ Object
810
811
812
813
814
815
816
817
818
819
820
|
# File 'lib/tdl/rebuild_ele/ele_base.rb', line 810
def test_inner_inst
as = TestAxiStream.new
as.dsize = 12
as.clock = 'clock_90M'
as.reset = "rst_n"
as.dimension = [9,4]
as.inst_name = "dt_inf"
puts as.instance
end
|
#undefine_main_func(name) ⇒ Object
281
282
283
284
285
286
|
# File 'lib/tdl/basefunc.rb', line 281
def undefine_main_func(name)
eval("undef #{name}")
end
|
#unfreeze_tdl_name_large_len ⇒ Object
18
19
20
|
# File 'lib/tdl/basefunc.rb', line 18
def unfreeze_tdl_name_large_len
$__tdl_name_large_len_freeze_en = false
end
|
#update_tdl_name_large_len(a) ⇒ Object
9
10
11
12
|
# File 'lib/tdl/basefunc.rb', line 9
def update_tdl_name_large_len(a)
raise TdlError.new("\n Cant assign $__tdl_name_large_len_freeze\n") if $__tdl_name_large_len_freeze_en
$__tdl_name_large_len = a
end
|
#with_main_funcs(func_hash, &block) ⇒ Object
288
289
290
291
292
293
294
295
296
297
298
299
|
# File 'lib/tdl/basefunc.rb', line 288
def with_main_funcs(func_hash,&block)
func_hash.each do |key,value|
define_main_func(key,&value)
end
yr = yield
func_hash.each do |key,value|
undefine_main_func(key)
end
return yr
end
|
#with_new_align(num = 0, &block) ⇒ Object