axi_tdl 0.1.3 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/axi/AXI4/axi4_direct_verc.sv +6 -0
- data/lib/axi/AXI4/axi4_dpram_cache.rb +3 -2
- data/lib/axi/AXI4/axi4_dpram_cache.sv +10 -10
- data/lib/axi/AXI4/axi4_ram_cache.rb +23 -0
- data/lib/axi/AXI4/axi4_ram_cache.sv +39 -0
- data/lib/axi/AXI4/axi4_rd_auxiliary_gen_A2.sv +112 -0
- data/lib/axi/AXI4/axi4_rd_burst_track.sv +2 -1
- data/lib/axi/AXI4/axi4_wr_burst_track.sv +2 -1
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +11 -11
- data/lib/axi/AXI4/long_axis_to_axi4_wr.rb +113 -0
- data/lib/axi/AXI4/long_axis_to_axi4_wr.sv +125 -0
- data/lib/axi/AXI4/odata_pool_axi4_A3.sv +12 -4
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +5 -5
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +8 -4
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +5 -5
- data/lib/axi/AXI4/vcs_axi4_comptable.sv +35 -9
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +1 -1
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +8 -8
- data/lib/axi/AXI4/width_convert/odd_width_convert.sv +1 -1
- data/lib/axi/AXI_stream/axi_stream_split_channel.rb +5 -2
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +32 -29
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +10 -10
- data/lib/axi/AXI_stream/axis_insert_copy.sv +2 -2
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +3 -3
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +5 -5
- data/lib/axi/AXI_stream/axis_sim_master_model.sv +2 -2
- data/lib/axi/AXI_stream/axis_split_channel_verb.sv +2 -2
- data/lib/axi/AXI_stream/data_width/axis_width_convert_verb.sv +50 -0
- data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +2 -0
- data/lib/axi/AXI_stream/parse_big_field_table_verb.sv +5 -3
- data/lib/axi/common/test_write_mem.sv +1 -1
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +12 -12
- data/lib/axi/platform_ip/long_fifo_verb.sv +1 -1
- data/lib/axi/platform_ip/wide_fifo.sv +1 -1
- data/lib/axi/platform_ip/xilinx_fifo_verb.sv +1 -1
- data/lib/axi/platform_ip/xilinx_fifo_verc.sv +2 -1
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +1 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +6 -6
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/axi_tdl.rb +31 -1
- data/lib/public_atom_module/sim/clock_rst_verc.sv +69 -0
- data/lib/public_atom_module/sim_system_pkg.sv +4 -0
- data/lib/public_atom_module/synth_system_pkg.sv +4 -0
- data/lib/tdl/Logic/logic_edge.rb +14 -6
- data/lib/tdl/Logic/logic_latency.rb +7 -7
- data/lib/tdl/auto_script/autogensdl.rb +2 -3
- data/lib/tdl/auto_script/import_hdl.rb +41 -5
- data/lib/tdl/auto_script/import_sdl.rb +43 -1
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +9 -14
- data/lib/tdl/class_hdl/hdl_always_ff.rb +1 -1
- data/lib/tdl/class_hdl/hdl_data.rb +1 -1
- data/lib/tdl/class_hdl/hdl_generate.rb +2 -2
- data/lib/tdl/examples/11_test_unit/dve.tcl +153 -6
- data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +5 -4
- data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +7 -33
- data/lib/tdl/examples/11_test_unit/exp_test_unit_sim.sv +33 -7
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +2 -2
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +2 -2
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -1
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +1 -2
- data/lib/tdl/examples/11_test_unit/tu0.sv +4 -6
- data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/module_instance_test.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_inst_sugar.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_port.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +6 -6
- data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
- data/lib/tdl/examples/3_hdl_sdl_instance/main_md.sv +2 -2
- data/lib/tdl/examples/6_module_with_interface/example_interface.sv +8 -8
- data/lib/tdl/examples/6_module_with_interface/inf_collect.sv +9 -9
- data/lib/tdl/examples/8_top_module/dve.tcl +6 -0
- data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -2
- data/lib/tdl/examples/8_top_module/tb_test_top_sim.sv +1 -1
- data/lib/tdl/examples/8_top_module/test_top.sv +1 -1
- data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +2 -1
- data/lib/tdl/examples/9_itegration/dve.tcl +6 -0
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +1 -3
- data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +1 -2
- data/lib/tdl/examples/9_itegration/test_tttop.sv +2 -2
- data/lib/tdl/exlib/axis_eth_ex.rb +1 -1
- data/lib/tdl/exlib/axis_verify.rb +2 -2
- data/lib/tdl/exlib/constraints_verb.rb +1 -0
- data/lib/tdl/exlib/itegration_verb.rb +45 -39
- data/lib/tdl/exlib/logic_verify.rb +1 -1
- data/lib/tdl/rebuild_ele/axi4.rb +6 -2
- data/lib/tdl/rebuild_ele/axi_stream.rb +3 -3
- data/lib/tdl/rebuild_ele/data_inf_c.rb +2 -2
- data/lib/tdl/rebuild_ele/ele_base.rb +7 -2
- data/lib/tdl/sdlmodule/sdlmodule.rb +73 -1
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodule_vcs_comptable.rb +3 -3
- data/lib/tdl/sdlmodule/test_unit_module.rb +4 -1
- data/lib/tdl/sdlmodule/top_module.rb +4 -0
- data/lib/tdl/tdl.rb +1 -11
- metadata +12 -3
@@ -5,7 +5,7 @@ _______________________________________
|
|
5
5
|
descript:
|
6
6
|
author : Cook.Darwin
|
7
7
|
Version: VERA.0.0
|
8
|
-
created: 2021-04-03
|
8
|
+
created: 2021-04-03 14:03:23 +0800
|
9
9
|
madified:
|
10
10
|
***********************************************/
|
11
11
|
`timescale 1ns/1ps
|
@@ -47,11 +47,11 @@ axis_sim_master_model #(
|
|
47
47
|
.LOOP ("TRUE" ),
|
48
48
|
.RAM_DEPTH (246 )
|
49
49
|
)sim_model_inst_origin_inf(
|
50
|
-
/* input */.enable (
|
51
|
-
/* input */.load_trigger (1'b0
|
52
|
-
/* input */.total_length (246
|
53
|
-
/* input */.mem_file ("/home/wmy367/work/gem/axi_tdl/lib/tdl/auto_script/tmp/
|
54
|
-
/* axi_stream_inf.master */.out_inf (origin_inf
|
50
|
+
/* input */.enable (1'b1 ),
|
51
|
+
/* input */.load_trigger (1'b0 ),
|
52
|
+
/* input */.total_length (246 ),
|
53
|
+
/* input */.mem_file ("/home/wmy367/work/gem/axi_tdl/lib/tdl/auto_script/tmp/coe_origin_inf_R1699.coe" ),
|
54
|
+
/* axi_stream_inf.master */.out_inf (origin_inf )
|
55
55
|
);
|
56
56
|
axis_sim_verify_by_coe #(
|
57
57
|
.RAM_DEPTH (21 ),
|
data/lib/axi_tdl/version.rb
CHANGED
data/lib/axi_tdl.rb
CHANGED
@@ -4,6 +4,7 @@ require "tdl/tdl.rb"
|
|
4
4
|
module AxiTdl
|
5
5
|
AXI_PATH = File.expand_path(File.join(__dir__,"axi"))
|
6
6
|
TDL_PATH = File.expand_path(File.join(__dir__,"tdl"))
|
7
|
+
PUBLIC_ATOM_PATH = File.expand_path(File.join(__dir__,"public_atom_module"))
|
7
8
|
end
|
8
9
|
|
9
10
|
|
@@ -15,14 +16,43 @@ add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4"))
|
|
15
16
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4/axi4_pipe"))
|
16
17
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4/interconnect"))
|
17
18
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4/width_convert"))
|
19
|
+
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4/packet_fifo"))
|
18
20
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/AXI4/packet_partition"))
|
21
|
+
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/axi4_to_xilinx_ddr_native"))
|
19
22
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/common_fifo"))
|
20
23
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/common"))
|
21
24
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/data_interface"))
|
22
25
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/data_interface/data_inf_c"))
|
23
26
|
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/techbench"))
|
24
|
-
|
27
|
+
add_to_tdl_paths File.expand_path(File.join(__dir__, "axi/platform_ip"))
|
28
|
+
add_to_tdl_paths File.expand_path(File.join(__dir__, "public_atom_module"))
|
29
|
+
add_to_tdl_paths File.expand_path(File.join(__dir__, "public_atom_module/sim"))
|
25
30
|
## base require
|
26
31
|
require_hdl 'axis_master_empty.sv'
|
27
32
|
require_hdl 'axis_slaver_empty.sv'
|
28
33
|
|
34
|
+
## contain common HDL
|
35
|
+
TopModule.contain_hdl("CheckPClock.sv","edge_generator.v","ClockSameDomain.sv","broaden_and_cross_clk.v","broaden.v","cross_clk_sync.v","latency.v","latency_long.v",'pipe_vld.sv')
|
36
|
+
|
37
|
+
### 这里引入可能不合适
|
38
|
+
TopModule.contain_hdl('axis_full_to_data_c.sv','data_c_pipe_inf.sv','data_c_to_axis_full.sv')
|
39
|
+
TopModule.contain_hdl('axi_stream_interconnect_M2S_A1.sv', 'data_c_pipe_intc_M2S_best_last.sv',"data_pipe_interconnect_S2M_verb.sv","data_valve.sv")
|
40
|
+
TopModule.contain_hdl('axis_direct_A1.sv',"axis_direct.sv", 'axi4_direct_A1.sv')
|
41
|
+
TopModule.contain_hdl 'axi_stream_interconnect_M2S.sv','data_pipe_interconnect_M2S_verb.sv'
|
42
|
+
# TopModule.contain_hdl('simple_data_pipe.sv')
|
43
|
+
TopModule.contain_hdl('long_fifo_verb.sv',"long_fifo_4bit.sv","long_fifo_4bit_SL8192.sv","long_fifo_4bit_8192.sv","wide_fifo.sv","wide_fifo_7series.sv")
|
44
|
+
|
45
|
+
TopModule.contain_hdl 'width_combin.sv'
|
46
|
+
|
47
|
+
TopModule.contain_hdl "data_inf_A2B.sv","data_inf_B2A.sv","data_c_direct.sv"
|
48
|
+
|
49
|
+
### 兼容性引入
|
50
|
+
require_hdl 'odata_pool_axi4_A3.sv'
|
51
|
+
require_hdl 'axis_append_A1.sv'
|
52
|
+
odata_pool_axi4_A3.contain_hdl('axi4_rd_auxiliary_gen_A1.sv',"xilinx_fifo_verb.sv","xilinx_fifo_A1.sv","fifo_36bit.sv","fifo_wr_rd_mark.sv")
|
53
|
+
axis_append_A1.contain_hdl('axi_streams_combin_A1.sv','data_c_scaler_A1.sv')
|
54
|
+
|
55
|
+
require_hdl 'axis_head_cut.sv'
|
56
|
+
axis_head_cut.contain_hdl("axis_filter.sv")
|
57
|
+
|
58
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________________________________________
|
3
|
+
_______ ___ ___ ___ __ _ _
|
4
|
+
_______ | | | |\ /| |___ | \ | /_\
|
5
|
+
_______ |___ |___| | \/ | |___ |__/ | / \
|
6
|
+
_______________________________________________
|
7
|
+
descript:
|
8
|
+
author : Young
|
9
|
+
Version: VERB.0.0
|
10
|
+
create a module for it
|
11
|
+
Version: VERC.0.0 ###### Tue Oct 13 14:44:58 CST 2020
|
12
|
+
add restart
|
13
|
+
creaded: 2015/10/16 10:50:52
|
14
|
+
madified:
|
15
|
+
***********************************************/
|
16
|
+
`timescale 1ns/1ps
|
17
|
+
(* data_inf = "true" *)
|
18
|
+
module clock_rst_verc #(
|
19
|
+
parameter bit ACTIVE = 1,
|
20
|
+
parameter longint PERIOD_CNT = 0,
|
21
|
+
parameter RST_HOLD = 5,
|
22
|
+
parameter real FreqM = 100
|
23
|
+
)(
|
24
|
+
input reboot,
|
25
|
+
output clock,
|
26
|
+
output rst_x
|
27
|
+
);
|
28
|
+
|
29
|
+
bit clk_pause = 1;
|
30
|
+
bit clock_reg;
|
31
|
+
bit rst_reg;
|
32
|
+
|
33
|
+
longint ccnt = 0;
|
34
|
+
|
35
|
+
initial begin
|
36
|
+
clk_pause = 1;
|
37
|
+
clock_reg = 0;
|
38
|
+
rst_reg = ACTIVE;
|
39
|
+
#(1000/FreqM*2);
|
40
|
+
clk_pause = 0;
|
41
|
+
repeat(RST_HOLD)
|
42
|
+
@(posedge clock_reg);
|
43
|
+
rst_reg = ~rst_reg;
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
always@(posedge reboot) begin
|
48
|
+
clk_pause = 1;
|
49
|
+
clock_reg = 0;
|
50
|
+
rst_reg = ACTIVE;
|
51
|
+
#(1000/FreqM*2);
|
52
|
+
clk_pause = 0;
|
53
|
+
repeat(RST_HOLD)
|
54
|
+
@(posedge clock_reg);
|
55
|
+
rst_reg = ~rst_reg;
|
56
|
+
end
|
57
|
+
|
58
|
+
always #(1000/FreqM/2) begin
|
59
|
+
if(clk_pause == 0 && (PERIOD_CNT==0 || ccnt < PERIOD_CNT))
|
60
|
+
clock_reg = ~clock_reg;
|
61
|
+
end
|
62
|
+
|
63
|
+
always@(posedge clock)
|
64
|
+
ccnt <= ccnt + 1;
|
65
|
+
|
66
|
+
assign clock = clock_reg;
|
67
|
+
assign rst_x = rst_reg;
|
68
|
+
|
69
|
+
endmodule
|
data/lib/tdl/Logic/logic_edge.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
class Logic ## EDGE METHOD
|
4
|
-
def raising(cnt:1,clock:nil,reset: 1.b1 )
|
4
|
+
def raising(name: nil, cnt: 1,clock: nil,reset: 1.b1 )
|
5
5
|
|
6
6
|
# if cnt==1 && clock == nil && reset==nil && @raising_record
|
7
7
|
# return @raising_record
|
@@ -26,11 +26,19 @@ class Logic ## EDGE METHOD
|
|
26
26
|
# GlobalParam.CurrTdlModule.BindEleClassVars.Logic.expression << lambda{ head_str }
|
27
27
|
belong_to_module.Logic_draw << head_str
|
28
28
|
inst_edge(@clock,@reset)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
unless name
|
30
|
+
if cnt>1
|
31
|
+
inst_raise_edge_cnt(cnt-1)
|
32
|
+
str = inst_cnt_edge_signal(cnt-1,:raise)
|
33
|
+
else
|
34
|
+
str = "#{signal}_raising"
|
35
|
+
|
36
|
+
end
|
37
|
+
else
|
38
|
+
if cnt>1
|
39
|
+
inst_raise_edge_cnt(cnt-1)
|
40
|
+
end
|
41
|
+
str = name
|
34
42
|
end
|
35
43
|
# @@logic_expression << lambda{ end_str }
|
36
44
|
# GlobalParam.CurrTdlModule.BindEleClassVars.Logic.expression << lambda{ end_str }
|
@@ -81,7 +81,7 @@ cross_clk_sync #(
|
|
81
81
|
if wclk.nil? || rclk.nil?
|
82
82
|
raise TdlError.new("\n #{self.to_s} BROADEN_AND_CROSS_CLK <clock = nil> \n")
|
83
83
|
end
|
84
|
-
new_l = belong_to_module.Def().logic(name:name || "broaden_and_cross_clk_#{
|
84
|
+
new_l = belong_to_module.Def().logic(name:name || "broaden_and_cross_clk_#{belong_to_module._auto_name_incr_index_()}",dsize:1)
|
85
85
|
large_name_len(phase,len,wclk,wreset,rclk,rreset)
|
86
86
|
body =
|
87
87
|
"
|
@@ -89,7 +89,7 @@ broaden_and_cross_clk #(
|
|
89
89
|
.PHASE (#{align_signal(phase)}), //POSITIVE NEGATIVE
|
90
90
|
.LEN (#{align_signal(len)}),
|
91
91
|
.LAT (#{align_signal(lat)})
|
92
|
-
)#{new_l.signal}_inst_#{
|
92
|
+
)#{new_l.signal}_inst_#{belong_to_module._auto_name_incr_index_()}(
|
93
93
|
/* input */ .rclk (#{align_signal(rclk,q_mark=false)}),
|
94
94
|
/* input */ .rd_rst_n (#{align_signal(rreset,q_mark=false)}),
|
95
95
|
/* input */ .wclk (#{align_signal(wclk,q_mark=false)}),
|
@@ -125,7 +125,7 @@ module CtrlLogic
|
|
125
125
|
latency #(
|
126
126
|
.LAT (#{num}),
|
127
127
|
.DSIZE (1)
|
128
|
-
)#{new_l.signal}_lat_#{
|
128
|
+
)#{new_l.signal}_lat_#{belong_to_module._auto_name_incr_index_()}(
|
129
129
|
#{clock},
|
130
130
|
#{reset_str},
|
131
131
|
#{self.to_s},
|
@@ -145,13 +145,13 @@ latency #(
|
|
145
145
|
|
146
146
|
# new_l = Logic.new(name:"crock_clk",dsize:self.dsize)
|
147
147
|
# new_l = self.logic(name:"crock_clk",dsize:self.dsize)
|
148
|
-
new_l = belong_to_module.Def().logic(name:name || "crock_clk_#{
|
148
|
+
new_l = belong_to_module.Def().logic(name:name || "crock_clk_#{belong_to_module._auto_name_incr_index_()}",dsize:dsize)
|
149
149
|
str = %Q{
|
150
150
|
//----->> #{self.to_s} cross clock <<------------------
|
151
151
|
cross_clk_sync #(
|
152
152
|
.LAT (2 ),
|
153
153
|
.DSIZE (#{dsize})
|
154
|
-
)#{new_l.signal}_cross_clk_inst__#{
|
154
|
+
)#{new_l.signal}_cross_clk_inst__#{belong_to_module._auto_name_incr_index_()}(
|
155
155
|
/* input */ .clk (#{align_signal(clock)}),
|
156
156
|
/* input */ .rst_n (#{align_signal(reset)}),
|
157
157
|
/* input [DSIZE-1:0] */ .d (#{align_signal(self)}),
|
@@ -168,7 +168,7 @@ cross_clk_sync #(
|
|
168
168
|
if wclk.nil? || rclk.nil?
|
169
169
|
raise TdlError.new("\n #{self.to_s} BROADEN_AND_CROSS_CLK <clock = nil> \n")
|
170
170
|
end
|
171
|
-
new_l = belong_to_module.Def().logic(name:name || "broaden_and_cross_clk_#{
|
171
|
+
new_l = belong_to_module.Def().logic(name:name || "broaden_and_cross_clk_#{belong_to_module._auto_name_incr_index_()}",dsize:1)
|
172
172
|
large_name_len(phase,len,wclk,wreset,rclk,rreset)
|
173
173
|
body =
|
174
174
|
"
|
@@ -176,7 +176,7 @@ broaden_and_cross_clk #(
|
|
176
176
|
.PHASE (#{align_signal(phase)}), //POSITIVE NEGATIVE
|
177
177
|
.LEN (#{align_signal(len)}),
|
178
178
|
.LAT (#{align_signal(lat)})
|
179
|
-
)#{new_l.signal}_inst_#{
|
179
|
+
)#{new_l.signal}_inst_#{belong_to_module._auto_name_incr_index_()}(
|
180
180
|
/* input */ .rclk (#{align_signal(rclk,q_mark=false)}),
|
181
181
|
/* input */ .rd_rst_n (#{align_signal(rreset,q_mark=false)}),
|
182
182
|
/* input */ .wclk (#{align_signal(wclk,q_mark=false)}),
|
@@ -2,13 +2,12 @@
|
|
2
2
|
|
3
3
|
class AutoGenSdl
|
4
4
|
attr_accessor :bad
|
5
|
-
def initialize(filename="",out_file_path=@@auto_path,
|
5
|
+
def initialize(filename="",out_file_path=@@auto_path,encoding='utf-8')
|
6
6
|
@expand_path = File.expand_path(filename)
|
7
7
|
sf = File.open(filename,"r")
|
8
|
-
fstr = sf.read.force_encoding(
|
8
|
+
fstr = sf.read.force_encoding(encoding)
|
9
9
|
sf.close
|
10
10
|
@bad = true
|
11
|
-
|
12
11
|
# return if exist_origin_sdl(filename,@expand_path)
|
13
12
|
# fstr.gsub!(/\/\/\s*\(\*\s*show\s*=\s*"false"\s*\*\)/,"(* show = \"false\" *)")
|
14
13
|
# SDL ignore `show`
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
def
|
3
|
-
basename = File.basename(hdl_path,"
|
1
|
+
$__contain_hdl__ = []
|
2
|
+
def __require_hdl__(hdl_path,current_sdlm=nil,encoding='utf-8')
|
3
|
+
basename = File.basename(hdl_path,".*")
|
4
4
|
unless SdlModule.exist_module? basename
|
5
5
|
## 检测是不是全路径, 或当前路径查得到
|
6
6
|
if File.exist? hdl_path
|
@@ -12,15 +12,47 @@ def require_hdl(hdl_path)
|
|
12
12
|
raise TdlError.new("Cant find <#{hdl_path}> in tdl paths !!!")
|
13
13
|
end
|
14
14
|
|
15
|
-
AutoGenSdl.new(rel,File.join(__dir__,"tmp")).auto_rb
|
15
|
+
AutoGenSdl.new(rel,File.join(__dir__,"tmp"),encoding=encoding).auto_rb
|
16
|
+
|
17
|
+
## 如果是 在非 sdlmodule 内引用需要添加contain_hdl
|
18
|
+
# if !(current_sdlm.is_a?(SdlModule))
|
19
|
+
# if TopModule.current
|
20
|
+
# TopModule.current.contain_hdl(rel)
|
21
|
+
# else
|
22
|
+
# unless $__contain_hdl__.include? rel
|
23
|
+
# $__contain_hdl__ << rel
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
if current_sdlm
|
28
|
+
current_sdlm.contain_hdl(rel)
|
29
|
+
else
|
30
|
+
unless $__contain_hdl__.include? rel
|
31
|
+
$__contain_hdl__ << rel
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
16
35
|
else
|
17
36
|
raise TdlError.new("path<#{hdl_path}> error!!!")
|
18
37
|
end
|
19
38
|
end
|
39
|
+
|
20
40
|
require_relative File.join(__dir__,"tmp","#{basename}_sdl.rb")
|
21
41
|
end
|
22
42
|
end
|
23
43
|
|
44
|
+
def TopModule.contain_hdl(*hdl_paths)
|
45
|
+
hdl_paths.each do |hdl_path|
|
46
|
+
rel = find_first_hdl_path(hdl_path)
|
47
|
+
unless rel
|
48
|
+
return nil
|
49
|
+
end
|
50
|
+
unless $__contain_hdl__.include? rel
|
51
|
+
$__contain_hdl__ << rel
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
24
56
|
unless File.exist? File.join(__dir__,'tmp')
|
25
57
|
Dir.mkdir File.join(__dir__,'tmp')
|
26
58
|
end
|
@@ -28,8 +60,12 @@ end
|
|
28
60
|
def find_first_hdl_path(basename)
|
29
61
|
$__tdl_paths__.each do |e|
|
30
62
|
if File.exist? File.join(e,basename)
|
31
|
-
return File.join(e,basename)
|
63
|
+
return File.expand_path(File.join(e,basename))
|
32
64
|
end
|
33
65
|
end
|
34
66
|
return nil
|
35
67
|
end
|
68
|
+
|
69
|
+
def require_hdl(hdl_path,encoding='utf-8')
|
70
|
+
__require_hdl__(hdl_path,nil,encoding)
|
71
|
+
end
|
@@ -23,4 +23,46 @@ def require_sdl(sdl_path)
|
|
23
23
|
end
|
24
24
|
# require_relative File.join(__dir__,"tmp","#{basename}_sdl.rb")
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
27
|
+
|
28
|
+
## 添加 模糊引入
|
29
|
+
def require_shdl(*shdl_name)
|
30
|
+
shdl_name.each do |s|
|
31
|
+
unless s.is_a? Array
|
32
|
+
__require_shdl__(s)
|
33
|
+
else
|
34
|
+
__require_shdl__(s[0],s[1])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def __require_shdl__(shdl_name,encoding='utf-8')
|
40
|
+
|
41
|
+
unless SdlModule.exist_module? shdl_name
|
42
|
+
sdl_path = "#{shdl_name}.rb"
|
43
|
+
rel = find_first_hdl_path(sdl_path)
|
44
|
+
## 匹配 SDL
|
45
|
+
if rel
|
46
|
+
require_relative rel
|
47
|
+
return
|
48
|
+
end
|
49
|
+
## 匹配 SV
|
50
|
+
sv_path = "#{shdl_name}.sv"
|
51
|
+
v_path = "#{shdl_name}.v"
|
52
|
+
vv_path = "#{shdl_name}.V"
|
53
|
+
|
54
|
+
rel = find_first_hdl_path(sv_path) || find_first_hdl_path(v_path) || find_first_hdl_path(vv_path)
|
55
|
+
if rel
|
56
|
+
AutoGenSdl.new(rel,File.join(__dir__,"tmp"),encoding=encoding).auto_rb
|
57
|
+
|
58
|
+
unless $__contain_hdl__.include? rel
|
59
|
+
$__contain_hdl__ << rel
|
60
|
+
end
|
61
|
+
|
62
|
+
require_relative File.join(__dir__,"tmp","#{shdl_name}_sdl.rb")
|
63
|
+
return
|
64
|
+
end
|
65
|
+
|
66
|
+
raise TdlError.new("Can find <#{shdl_name}> in tdl paths !!!")
|
67
|
+
end
|
68
|
+
end
|
@@ -68,7 +68,7 @@ class Axi4
|
|
68
68
|
e.band_params_from(self)
|
69
69
|
|
70
70
|
## e is a Vector
|
71
|
-
if e.dimension[0].is_a?(Integer) && e.dimension[0] > 1
|
71
|
+
if e.dimension && e.dimension[0].is_a?(Integer) && e.dimension[0] > 1
|
72
72
|
# require_hdl 'axi4_direct_B1.sv'
|
73
73
|
require_hdl 'axi4_direct_verc.sv'
|
74
74
|
|
@@ -189,8 +189,10 @@ class Axi4
|
|
189
189
|
@_long_slim_to_wide << new_master
|
190
190
|
else
|
191
191
|
if !(e.dsize.eql? self.dsize)
|
192
|
+
require_hdl 'axi4_long_to_axi4_wide_verb.sv'
|
193
|
+
TopModule.contain_hdl 'axi4_direct_verb.sv'
|
192
194
|
# puts "#{e.dsize} == #{self.dsize} #{e.dsize != self.dsize} #{e.dsize.class}"
|
193
|
-
new_master = self.copy(mode:e.mode,idsize:e.idsize)
|
195
|
+
new_master = self.copy(name: "#{e.name}_renew_dir",mode:e.mode,idsize:e.idsize)
|
194
196
|
# new_master.axi4_data_convert(up_stream: e)
|
195
197
|
# @_long_slim_to_wide << Axi4.axi4_pipe(up_stream:new_master)
|
196
198
|
|
@@ -245,20 +247,13 @@ class Axi4
|
|
245
247
|
else
|
246
248
|
mode_str = "ONLY_READ_to_BOTH"
|
247
249
|
end
|
248
|
-
|
249
|
-
# # Axi4.axi4_direct_a1(mode:mode_str,slaver:lo,master:"#{sub_name}[#{index}]",belong_to_module:belong_to_module)
|
250
|
-
# belong_to_module.Instance('axi4_direct_B1',"axi4_direct_a1_long_to_wide_#{sub_name}_#{globle_random_name_flag()}") do |h|
|
251
|
-
# # h.param.MODE mode_str #//ONLY_READ to BOTH,ONLY_WRITE to BOTH,BOTH to BOTH,BOTH to ONLY_READ,BOTH to ONLY_WRITE
|
252
|
-
# h.slaver_inf lo
|
253
|
-
# h.master_inf "#{sub_name}[#{index}]".to_nq
|
254
|
-
# end
|
255
|
-
|
250
|
+
|
256
251
|
require_hdl 'axi4_direct_verc.sv'
|
257
|
-
belong_to_module.Instance('axi4_direct_verc',"axi4_direct_a1_long_to_wide_#{sub_name}_#{
|
252
|
+
belong_to_module.Instance('axi4_direct_verc',"axi4_direct_a1_long_to_wide_#{sub_name}_#{belong_to_module._auto_name_incr_index_}") do |h|
|
258
253
|
h.param.MODE mode_str # //ONLY_READ to BOTH,ONLY_WRITE to BOTH,BOTH to BOTH,BOTH to ONLY_READ,BOTH to ONLY_WRITE
|
259
254
|
h.param.SLAVER_MODE (wr_lg ? "ONLY_WRITE" : "ONLY_READ") # //
|
260
255
|
h.param.MASTER_MODE "BOTH" # //
|
261
|
-
h.slaver_inf lo
|
256
|
+
h.slaver_inf (lo.respond_to?(:dimension) && (lo.dimension.nil? || lo.dimension[0]==1) && lo[0]) || lo
|
262
257
|
h.master_inf "#{sub_name}[#{index}]".to_nq
|
263
258
|
end
|
264
259
|
|
@@ -268,14 +263,14 @@ class Axi4
|
|
268
263
|
require_hdl 'axi4_combin_wr_rd_batch.sv'
|
269
264
|
if wr_lg
|
270
265
|
# Axi4.axi4_combin_wr_rd_batch(wr_slaver:lo,rd_slaver:los,master:"#{sub_name}[#{index}]",belong_to_module:belong_to_module)
|
271
|
-
belong_to_module.Instance(:axi4_combin_wr_rd_batch,"axi4_combin_wr_rd_batch_inst_#{sub_name}") do |h|
|
266
|
+
belong_to_module.Instance(:axi4_combin_wr_rd_batch,"axi4_combin_wr_rd_batch_inst_#{sub_name}_#{belong_to_module._auto_name_incr_index_}") do |h|
|
272
267
|
h.wr_slaver lo
|
273
268
|
h.rd_slaver los
|
274
269
|
h.master "#{sub_name}[#{index}]".to_nq
|
275
270
|
end
|
276
271
|
else
|
277
272
|
# Axi4.axi4_combin_wr_rd_batch(wr_slaver:los,rd_slaver:lo,master:"#{sub_name}[#{index}]",belong_to_module:belong_to_module)
|
278
|
-
belong_to_module.Instance(:axi4_combin_wr_rd_batch,"axi4_combin_wr_rd_batch_inst_#{sub_name}") do |h|
|
273
|
+
belong_to_module.Instance(:axi4_combin_wr_rd_batch,"axi4_combin_wr_rd_batch_inst_#{sub_name}_#{belong_to_module._auto_name_incr_index_}") do |h|
|
279
274
|
h.wr_slaver los
|
280
275
|
h.rd_slaver lo
|
281
276
|
h.master "#{sub_name}[#{index}]".to_nq
|
@@ -89,7 +89,7 @@ module ClassHDL
|
|
89
89
|
str.push op.instance(:always_ff).gsub(/^./){ |m| " #{m}"}
|
90
90
|
else
|
91
91
|
unless op.slaver
|
92
|
-
rel_str = ClassHDL.compact_op_ch(op.instance(:always_ff))
|
92
|
+
rel_str = ClassHDL.compact_op_ch(op.instance(:always_ff,belong_to_module))
|
93
93
|
str.push " #{rel_str};"
|
94
94
|
end
|
95
95
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Integer
|
2
2
|
|
3
3
|
def method_missing(method,arg=nil)
|
4
|
-
if method.to_s =~ /^s?[h|d]\d+$/i || method.to_s =~ /^s?[b](0|1|_)+$/i || method.to_s =~ /^s?[h][\d]?[\d|a-f]+$/i
|
4
|
+
if method.to_s =~ /^s?[h|d][\d|_]+$/i || method.to_s =~ /^s?[b](0|1|_)+$/i || method.to_s =~ /^s?[h][\d]?[\d|a-f|_]+$/i
|
5
5
|
if self.nonzero?
|
6
6
|
return "#{self.to_s}'#{method}".to_nq
|
7
7
|
else
|
@@ -19,7 +19,7 @@ module ClassHDL
|
|
19
19
|
attr_accessor :block_index
|
20
20
|
def initialize(belong_to_module)
|
21
21
|
@belong_to_module = belong_to_module
|
22
|
-
super("genblk#{
|
22
|
+
super("genblk#{belong_to_module._auto_name_incr_index_}")
|
23
23
|
unless @belong_to_module
|
24
24
|
raise TdlError.new("GenerateBlock must have belong_to_module")
|
25
25
|
end
|
@@ -70,7 +70,7 @@ module ClassHDL
|
|
70
70
|
def ELSIF(cond,&block)
|
71
71
|
if ClassHDL::AssignDefOpertor.curr_assign_block.is_a? HDLAssignGenerateBlock
|
72
72
|
if cond.respond_to?(:instance)
|
73
|
-
head_str = "else if(#{cond.instance(:cond)})begin\n"
|
73
|
+
head_str = "else if(#{cond.instance(:cond,@belong_to_module)})begin\n"
|
74
74
|
else
|
75
75
|
head_str = "else if(#{cond})begin\n"
|
76
76
|
end
|