axi_tdl 0.1.0 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -0
  3. data/lib/axi/AXI4/axi4_direct_A1.sv +1 -1
  4. data/lib/axi/AXI4/axi4_direct_verc.sv +54 -54
  5. data/lib/axi/AXI4/axi4_dpram_cache.rb +1 -0
  6. data/lib/axi/AXI4/axi4_dpram_cache.sv +10 -10
  7. data/lib/axi/AXI4/axi4_rd_burst_track.sv +2 -1
  8. data/lib/axi/AXI4/axi4_wr_burst_track.sv +2 -1
  9. data/lib/axi/AXI4/axis_to_axi4_wr.sv +9 -9
  10. data/lib/axi/AXI4/odata_pool_axi4_A3.sv +7 -0
  11. data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +5 -5
  12. data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +8 -4
  13. data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +6 -6
  14. data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +12 -12
  15. data/lib/axi/AXI_stream/axi_stream_split_channel.sv +154 -0
  16. data/lib/axi/AXI_stream/axis_head_cut_verc.sv +242 -0
  17. data/lib/axi/AXI_stream/axis_insert_copy.sv +79 -0
  18. data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +48 -0
  19. data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +113 -0
  20. data/lib/axi/AXI_stream/axis_sim_master_model.rb +2 -0
  21. data/lib/axi/AXI_stream/axis_sim_master_model.sv +46 -0
  22. data/lib/axi/AXI_stream/axis_split_channel_verb.sv +62 -0
  23. data/lib/axi/AXI_stream/data_width/axis_width_convert_verb.sv +50 -0
  24. data/lib/axi/AXI_stream/packet_fifo/axi_stream_packet_long_fifo.sv +2 -0
  25. data/lib/axi/AXI_stream/parse_big_field_table_verb.sv +5 -3
  26. data/lib/axi/common/common_ram_sim_wrapper.sv +1 -1
  27. data/lib/axi/common/common_ram_wrapper.sv +1 -1
  28. data/lib/axi/common/test_write_mem.sv +1 -1
  29. data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +13 -13
  30. data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +14 -11
  31. data/lib/axi/platform_ip/fifo_36kb_long.sv +1 -1
  32. data/lib/axi/platform_ip/long_fifo_verb.sv +1 -1
  33. data/lib/axi/platform_ip/wide_fifo.sv +1 -1
  34. data/lib/axi/platform_ip/xilinx_fifo_verb.sv +1 -1
  35. data/lib/axi/platform_ip/xilinx_fifo_verc.sv +2 -1
  36. data/lib/axi/techbench/tb_axi_stream_split_channel.rb +2 -1
  37. data/lib/axi/techbench/tb_axi_stream_split_channel.sv +46 -45
  38. data/lib/axi_tdl.rb +31 -1
  39. data/lib/axi_tdl/version.rb +1 -1
  40. data/lib/public_atom_module/CheckPClock.sv +53 -0
  41. data/lib/public_atom_module/LICENSE.md +674 -0
  42. data/lib/public_atom_module/altera_xilinx_always_block_sw.rb +57 -0
  43. data/lib/public_atom_module/bits_decode.sv +71 -0
  44. data/lib/public_atom_module/bits_decode_verb.sv +71 -0
  45. data/lib/public_atom_module/bits_decode_verb_sdl.rb +24 -0
  46. data/lib/public_atom_module/broaden.v +43 -0
  47. data/lib/public_atom_module/broaden_and_cross_clk.v +47 -0
  48. data/lib/public_atom_module/ceiling.v +39 -0
  49. data/lib/public_atom_module/ceiling_A1.v +42 -0
  50. data/lib/public_atom_module/clock_rst.sv +64 -0
  51. data/lib/public_atom_module/cross_clk_sync.v +37 -0
  52. data/lib/public_atom_module/edge_generator.v +50 -0
  53. data/lib/public_atom_module/flooring.v +36 -0
  54. data/lib/public_atom_module/latch_data.v +30 -0
  55. data/lib/public_atom_module/latency.v +48 -0
  56. data/lib/public_atom_module/latency_dynamic.v +83 -0
  57. data/lib/public_atom_module/latency_long.v +84 -0
  58. data/lib/public_atom_module/latency_verb.v +52 -0
  59. data/lib/public_atom_module/once_event.sv +65 -0
  60. data/lib/public_atom_module/pipe_reg.v +93 -0
  61. data/lib/public_atom_module/pipe_reg_2write_ports.v +84 -0
  62. data/lib/public_atom_module/sim/clock_rst_verb.sv +54 -0
  63. data/lib/public_atom_module/sim/clock_rst_verc.sv +69 -0
  64. data/lib/public_atom_module/sim/latency_long_tb.sv +49 -0
  65. data/lib/public_atom_module/sim/latency_long_tb.sv.bak +49 -0
  66. data/lib/public_atom_module/sim_system_pkg.sv +4 -0
  67. data/lib/public_atom_module/synth_system_pkg.sv +4 -0
  68. data/lib/tdl/Logic/logic_edge.rb +1 -1
  69. data/lib/tdl/auto_script/autogensdl.rb +2 -3
  70. data/lib/tdl/auto_script/import_hdl.rb +40 -5
  71. data/lib/tdl/axi4/axi4_interconnect_verb.rb +47 -10
  72. data/lib/tdl/class_hdl/hdl_always_comb.rb +4 -1
  73. data/lib/tdl/class_hdl/hdl_always_ff.rb +3 -3
  74. data/lib/tdl/class_hdl/hdl_assign.rb +7 -1
  75. data/lib/tdl/class_hdl/hdl_block_ifelse.rb +7 -7
  76. data/lib/tdl/class_hdl/hdl_foreach.rb +2 -2
  77. data/lib/tdl/class_hdl/hdl_function.rb +4 -4
  78. data/lib/tdl/class_hdl/hdl_generate.rb +5 -2
  79. data/lib/tdl/class_hdl/hdl_initial.rb +25 -3
  80. data/lib/tdl/class_hdl/hdl_module_def.rb +9 -6
  81. data/lib/tdl/class_hdl/hdl_package.rb +45 -0
  82. data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +99 -27
  83. data/lib/tdl/class_hdl/hdl_struct.rb +2 -2
  84. data/lib/tdl/elements/Reset.rb +5 -9
  85. data/lib/tdl/elements/clock.rb +5 -9
  86. data/lib/tdl/elements/data_inf.rb +0 -17
  87. data/lib/tdl/elements/logic.rb +9 -31
  88. data/lib/tdl/elements/mail_box.rb +6 -1
  89. data/lib/tdl/elements/originclass.rb +17 -47
  90. data/lib/tdl/elements/parameter.rb +5 -6
  91. data/lib/tdl/examples/11_test_unit/dve.tcl +6 -153
  92. data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +2 -2
  93. data/lib/tdl/examples/11_test_unit/exp_test_unit_sim.sv +9 -0
  94. data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +2 -2
  95. data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +2 -2
  96. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -1
  97. data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +41 -0
  98. data/lib/tdl/examples/11_test_unit/tu0.sv +2 -1
  99. data/lib/tdl/examples/1_define_module/exmple_md.sv +1 -1
  100. data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +3 -3
  101. data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +3 -3
  102. data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +3 -3
  103. data/lib/tdl/examples/2_hdl_class/tmp/module_instance_test.sv +1 -1
  104. data/lib/tdl/examples/2_hdl_class/tmp/simple_assign_test.sv +3 -3
  105. data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +3 -3
  106. data/lib/tdl/examples/2_hdl_class/tmp/test_inst_sugar.sv +1 -1
  107. data/lib/tdl/examples/2_hdl_class/tmp/test_module.sv +3 -3
  108. data/lib/tdl/examples/2_hdl_class/tmp/test_module_port.sv +2 -2
  109. data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +7 -7
  110. data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +4 -3
  111. data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
  112. data/lib/tdl/examples/3_hdl_sdl_instance/main_md.sv +2 -2
  113. data/lib/tdl/examples/3_hdl_sdl_instance/sdl_md.sv +1 -1
  114. data/lib/tdl/examples/6_module_with_interface/example_interface.sv +8 -8
  115. data/lib/tdl/examples/6_module_with_interface/inf_collect.sv +9 -9
  116. data/lib/tdl/examples/7_module_with_package/body_package.sv +4 -3
  117. data/lib/tdl/examples/7_module_with_package/example_pkg.sv +1 -1
  118. data/lib/tdl/examples/7_module_with_package/head_package.sv +4 -3
  119. data/lib/tdl/examples/8_top_module/dve.tcl +6 -0
  120. data/lib/tdl/examples/8_top_module/tb_test_top.sv +1 -1
  121. data/lib/tdl/examples/8_top_module/tb_test_top_sim.sv +29 -0
  122. data/lib/tdl/examples/8_top_module/test_top.sv +1 -1
  123. data/lib/tdl/examples/8_top_module/test_top_sim.sv +9 -0
  124. data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +2 -1
  125. data/lib/tdl/examples/9_itegration/dve.tcl +155 -2
  126. data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +1 -1
  127. data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +1 -1
  128. data/lib/tdl/examples/9_itegration/test_tttop.sv +7 -38
  129. data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +38 -7
  130. data/lib/tdl/exlib/axis_verify.rb +4 -3
  131. data/lib/tdl/exlib/constraints_verb.rb +1 -0
  132. data/lib/tdl/exlib/itegration_verb.rb +47 -41
  133. data/lib/tdl/rebuild_ele/ele_base.rb +15 -10
  134. data/lib/tdl/sdlmodule/sdlmodule.rb +117 -51
  135. data/lib/tdl/sdlmodule/sdlmodule_arraychain.rb +1 -1
  136. data/lib/tdl/sdlmodule/sdlmodule_draw.rb +2 -2
  137. data/lib/tdl/sdlmodule/sdlmodule_instance.rb +3 -0
  138. data/lib/tdl/sdlmodule/sdlmodule_port_define.rb +6 -6
  139. data/lib/tdl/sdlmodule/sdlmodule_varible.rb +6 -6
  140. data/lib/tdl/sdlmodule/test_unit_module.rb +6 -0
  141. data/lib/tdl/sdlmodule/top_module.rb +4 -0
  142. data/lib/tdl/tdl.rb +1 -11
  143. data/lib/tdl/tdlerror/tdlerror.rb +1 -1
  144. metadata +43 -5
  145. data/CODE_OF_CONDUCT.md +0 -74
  146. data/lib/axi/AXI_stream/axis_length_split_writh_user.sv +0 -87
@@ -0,0 +1,93 @@
1
+ /**********************************************
2
+ ______________ ______________
3
+ ______________ \ /\ /|\ /| ______________
4
+ ______________ \/ \/ | \/ | ______________
5
+ descript:
6
+ author : Young
7
+ Version: VERA.0.0
8
+ creaded: 2015/7/9 9:20:55
9
+ madified:
10
+ ***********************************************/
11
+ `timescale 1ns/1ps
12
+ module pipe_reg #(
13
+ parameter DSIZE = 8
14
+ )(
15
+ input clock ,
16
+ input rst_n ,
17
+ input wr_en ,
18
+ input [DSIZE-1:0] indata ,
19
+ input low_empty ,
20
+ output valid ,
21
+ output curr_empty ,
22
+ output sum_empty ,
23
+ output[DSIZE-1:0] outdata ,
24
+ output high_reload
25
+ );
26
+
27
+ /*
28
+ table
29
+ higher_vld(wr_en) curr_valid low_empty : next_valid next_data curr_empty sum_empty
30
+ 1 1 1 : 1 U 0 curr_empty | low_empty
31
+ 1 1 0 : 1 K 0 curr_empty | low_empty
32
+ 1 0 1 : 1 U 0 curr_empty | low_empty
33
+ 1 0 0 : 1 U 0 curr_empty | low_empty
34
+ 0 1 1 : 0 C 1 curr_empty | low_empty
35
+ 0 1 0 : 1 K 0 curr_empty | low_empty
36
+ 0 0 1 : 0 C 1 curr_empty | low_empty
37
+ 0 0 0 : 0 C 1 curr_empty | low_empty
38
+ */
39
+
40
+ reg data_vld;
41
+ reg[DSIZE-1:0] data_reg;
42
+ reg reload_reg;
43
+
44
+ always@(posedge clock/*,negedge rst_n*/)
45
+ if(~rst_n) data_vld <= 1'b0;
46
+ else
47
+ case({wr_en,data_vld,low_empty})
48
+ 3'b111,
49
+ 3'b110,
50
+ 3'b101,
51
+ 3'b100,
52
+ 3'b010: data_vld <= 1'b1;
53
+ default:data_vld <= 1'b0;
54
+ endcase
55
+
56
+ always@(posedge clock/*,negedge rst_n*/)
57
+ if(~rst_n) reload_reg <= 1'b0;
58
+ else
59
+ case({wr_en,data_vld,low_empty})
60
+ 3'b111: reload_reg <= 1'b1;
61
+ 3'b110: reload_reg <= 1'b0;
62
+ 3'b101: reload_reg <= 1'b1;
63
+ 3'b100: reload_reg <= 1'b1;
64
+ 3'b011: reload_reg <= 1'b1;
65
+ 3'b010: reload_reg <= 1'b0;
66
+ 3'b001: reload_reg <= 1'b1;
67
+ 3'b000: reload_reg <= 1'b1;
68
+ default:reload_reg <= 1'b0;
69
+ endcase
70
+
71
+ always@(posedge clock/*,negedge rst_n*/)
72
+ if(~rst_n) data_reg <= {DSIZE{1'b0}};
73
+ else
74
+ case({wr_en,data_vld,low_empty})
75
+ 3'b111: data_reg <= indata;
76
+ 3'b110: data_reg <= data_reg;
77
+ 3'b101: data_reg <= indata;
78
+ 3'b100: data_reg <= indata;
79
+ 3'b011: data_reg <= {DSIZE{1'b0}};
80
+ 3'b010: data_reg <= data_reg;
81
+ 3'b001: data_reg <= {DSIZE{1'b0}};
82
+ 3'b000: data_reg <= {DSIZE{1'b0}};
83
+ default:data_reg <= {DSIZE{1'b0}};
84
+ endcase
85
+
86
+ assign curr_empty = !data_vld;
87
+ assign outdata = data_reg;
88
+ assign valid = data_vld;
89
+ assign sum_empty = curr_empty | low_empty;
90
+ assign high_reload = reload_reg;
91
+
92
+ endmodule
93
+
@@ -0,0 +1,84 @@
1
+ /**********************************************
2
+ ______________ ______________
3
+ ______________ \ /\ /|\ /| ______________
4
+ ______________ \/ \/ | \/ | ______________
5
+ descript:
6
+ author : Young
7
+ Version: VERA.0.0
8
+ creaded: 2015/7/9 9:20:55
9
+ madified:
10
+ ***********************************************/
11
+ `timescale 1ns/1ps
12
+ module pipe_reg_2write_port #(
13
+ parameter DSIZE = 8
14
+ )(
15
+ input clock ,
16
+ input rst_n ,
17
+ input wr_en0 ,
18
+ input [DSIZE-1:0] indata0 ,
19
+ input wr_en1 ,
20
+ input [DSIZE-1:0] indata1 ,
21
+ input low_empty ,
22
+ output valid ,
23
+ output curr_empty ,
24
+ output sum_empty ,
25
+ output[DSIZE-1:0] outdata
26
+ );
27
+
28
+ wire[DSIZE-1:0] indata;
29
+ wire wr_en;
30
+
31
+ assign indata = wr_en0? indata0 : (wr_en1? indata0 :{DSIZE{1'b0}});
32
+ assign wr_en = wr_en0 | wr_en1;
33
+
34
+ /*
35
+ table
36
+ higher_vld(wr_en) curr_valid low_empty : next_valid next_data curr_empty sum_empty
37
+ 1 1 1 : 1 U 0 curr_empty | low_empty
38
+ 1 1 0 : 1 K 0 curr_empty | low_empty
39
+ 1 0 1 : 1 U 0 curr_empty | low_empty
40
+ 1 0 0 : 1 U 0 curr_empty | low_empty
41
+ 0 1 1 : 0 C 1 curr_empty | low_empty
42
+ 0 1 0 : 1 K 0 curr_empty | low_empty
43
+ 0 0 1 : 0 C 1 curr_empty | low_empty
44
+ 0 0 0 : 0 C 1 curr_empty | low_empty
45
+ */
46
+
47
+ reg data_vld;
48
+ reg[DSIZE-1:0] data_reg;
49
+
50
+ always@(posedge clock/*,negedge rst_n*/)
51
+ if(~rst_n) data_vld <= 1'b0;
52
+ else
53
+ case({wr_en,data_vld,low_empty})
54
+ 3'b111,
55
+ 3'b110,
56
+ 3'b101,
57
+ 3'b100,
58
+ 3'b010: data_vld <= 1'b1;
59
+ default:data_vld <= 1'b0;
60
+ endcase
61
+
62
+ always@(posedge clock/*,negedge rst_n*/)
63
+ if(~rst_n) data_reg <= {DSIZE{1'b0}};
64
+ else
65
+ case({wr_en,data_vld,low_empty})
66
+ 3'b111: data_reg <= indata;
67
+ 3'b110: data_reg <= data_reg;
68
+ 3'b101: data_reg <= indata;
69
+ 3'b100: data_reg <= indata;
70
+ 3'b011: data_reg <= {DSIZE{1'b0}};
71
+ 3'b010: data_reg <= data_reg;
72
+ 3'b001: data_reg <= {DSIZE{1'b0}};
73
+ 3'b000: data_reg <= {DSIZE{1'b0}};
74
+ default:data_reg <= {DSIZE{1'b0}};
75
+ endcase
76
+
77
+
78
+ assign curr_empty = !data_vld;
79
+ assign outdata = data_reg;
80
+ assign valid = data_vld;
81
+ assign sum_empty = curr_empty | low_empty;
82
+
83
+ endmodule
84
+
@@ -0,0 +1,54 @@
1
+ /**********************************************
2
+ ______________________________________________
3
+ _______ ___ ___ ___ __ _ _
4
+ _______ | | | |\ /| |___ | \ | /_\
5
+ _______ |___ |___| | \/ | |___ |__/ | / \
6
+ _______________________________________________
7
+ descript:
8
+ author : Young
9
+ Version: VERB.0.0
10
+ create a module for it
11
+ creaded: 2015/10/16 10:50:52
12
+ madified:
13
+ ***********************************************/
14
+ `timescale 1ns/1ps
15
+ (* data_inf = "true" *)
16
+ module clock_rst_verb #(
17
+ parameter bit ACTIVE = 1,
18
+ parameter longint PERIOD_CNT = 0,
19
+ parameter RST_HOLD = 5,
20
+ parameter real FreqM = 100
21
+ )(
22
+ output clock,
23
+ output rst_x
24
+ );
25
+
26
+ bit clk_pause = 1;
27
+ bit clock_reg;
28
+ bit rst_reg;
29
+
30
+ longint ccnt = 0;
31
+
32
+ initial begin
33
+ clk_pause = 1;
34
+ clock_reg = 0;
35
+ rst_reg = ACTIVE;
36
+ #(1000/FreqM*2);
37
+ clk_pause = 0;
38
+ repeat(RST_HOLD)
39
+ @(posedge clock_reg);
40
+ rst_reg = ~rst_reg;
41
+ end
42
+
43
+ always #(1000/FreqM/2) begin
44
+ if(clk_pause == 0 && (PERIOD_CNT==0 || ccnt < PERIOD_CNT))
45
+ clock_reg = ~clock_reg;
46
+ end
47
+
48
+ always@(posedge clock)
49
+ ccnt <= ccnt + 1;
50
+
51
+ assign clock = clock_reg;
52
+ assign rst_x = rst_reg;
53
+
54
+ endmodule
@@ -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
@@ -0,0 +1,49 @@
1
+ /**********************************************
2
+ ______________ ______________
3
+ ______________ \ /\ /|\ /| ______________
4
+ ______________ \/ \/ | \/ | ______________
5
+ descript:
6
+ author : Young
7
+ Version: VERA.0.0
8
+ creaded: 2015/12/1 14:28:31
9
+ madified:
10
+ ***********************************************/
11
+ `timescale 1ns/1ps
12
+ module latency_long_tb;
13
+
14
+ bit clock = 0;
15
+ bit rst_n = 0;
16
+
17
+ always #5 clock = ~clock;
18
+
19
+ initial begin
20
+ repeat(10) @(posedge clock);
21
+ rst_n = 1;
22
+ end
23
+
24
+ bit d;
25
+
26
+ initial begin
27
+ d = 0 ;
28
+ wait(rst_n);
29
+ repeat(20) @(posedge clock);
30
+ d = 1;
31
+ repeat(1) @(posedge clock);
32
+ d = 0;
33
+ end
34
+
35
+ latency_long #(
36
+ .LAT (5 )
37
+ )latency_long_inst(
38
+ .clock (clock ),
39
+ .rst_n (rst_n ),
40
+ .d (d ),
41
+ .q ( )
42
+ );
43
+
44
+
45
+ endmodule
46
+
47
+
48
+
49
+
@@ -0,0 +1,49 @@
1
+ /**********************************************
2
+ ______________ ______________
3
+ ______________ \ /\ /|\ /| ______________
4
+ ______________ \/ \/ | \/ | ______________
5
+ descript:
6
+ author : Young
7
+ Version: VERA.0.0
8
+ creaded: 2015/12/1 14:28:31
9
+ madified:
10
+ ***********************************************/
11
+ `timescale 1ns/1ps
12
+ module latency_long_tb;
13
+
14
+ bit clock = 0;
15
+ bit rst_n = 0;
16
+
17
+ always #5 clock = ~clock;
18
+
19
+ initial begin
20
+ repeat(10) @(posedge clock);
21
+ rst_n = 1;
22
+ end
23
+
24
+ bit d;
25
+
26
+ initial begin
27
+ d = 0 ;
28
+ wait(rst_n);
29
+ repeat(20) @(posedge clock);
30
+ d = 1;
31
+ repeat(10) @(posedge clock);
32
+ d = 0;
33
+ end
34
+
35
+ latency_long #(
36
+ .LAT (5 )
37
+ )latency_long_inst(
38
+ .clock (clock ),
39
+ .rst_n (rst_n ),
40
+ .d (d ),
41
+ .q ( )
42
+ );
43
+
44
+
45
+ endmodule
46
+
47
+
48
+
49
+
@@ -0,0 +1,4 @@
1
+ package SystemPkg;
2
+ parameter SIM = "ON";
3
+
4
+ endpackage
@@ -0,0 +1,4 @@
1
+ package SystemPkg;
2
+ parameter SIM = "OFF";
3
+
4
+ endpackage
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  class Logic ## EDGE METHOD
4
- def raising(cnt:1,clock:nil,reset:nil)
4
+ def raising(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
@@ -2,13 +2,12 @@
2
2
 
3
3
  class AutoGenSdl
4
4
  attr_accessor :bad
5
- def initialize(filename="",out_file_path=@@auto_path,info=true)
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("utf-8")
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 require_hdl(hdl_path)
3
- basename = File.basename(hdl_path,".sv")
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,7 +12,26 @@ 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
@@ -21,6 +40,18 @@ def require_hdl(hdl_path)
21
40
  end
22
41
  end
23
42
 
43
+ def TopModule.contain_hdl(*hdl_paths)
44
+ hdl_paths.each do |hdl_path|
45
+ rel = find_first_hdl_path(hdl_path)
46
+ unless rel
47
+ return nil
48
+ end
49
+ unless $__contain_hdl__.include? rel
50
+ $__contain_hdl__ << rel
51
+ end
52
+ end
53
+ end
54
+
24
55
  unless File.exist? File.join(__dir__,'tmp')
25
56
  Dir.mkdir File.join(__dir__,'tmp')
26
57
  end
@@ -28,8 +59,12 @@ end
28
59
  def find_first_hdl_path(basename)
29
60
  $__tdl_paths__.each do |e|
30
61
  if File.exist? File.join(e,basename)
31
- return File.join(e,basename)
62
+ return File.expand_path(File.join(e,basename))
32
63
  end
33
64
  end
34
65
  return nil
35
66
  end
67
+
68
+ def require_hdl(hdl_path,encoding='utf-8')
69
+ __require_hdl__(hdl_path,nil,encoding)
70
+ end