axi_tdl 0.0.12 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +4 -2
- data/.gitignore +3 -1
- data/README.EN.md +7 -2
- data/README.md +6 -2
- data/Rakefile +8 -1
- data/axi_tdl.gemspec +1 -2
- data/lib/axi/AXI4/axi4_direct_A1.sv +1 -1
- data/lib/axi/AXI4/axi4_direct_B1.sv +23 -23
- data/lib/axi/AXI4/axi4_direct_verc.sv +54 -54
- data/lib/axi/AXI4/axi4_dpram_cache.sv +34 -34
- data/lib/axi/AXI4/axis_to_axi4_wr.rb +1 -0
- data/lib/axi/AXI4/axis_to_axi4_wr.sv +24 -24
- data/lib/axi/AXI4/odata_pool_axi4_A3.sv +7 -0
- data/lib/axi/AXI4/packet_partition/axi4_partition_rd_verb.sv +33 -33
- data/lib/axi/AXI4/packet_partition/data_inf_partition.rb +2 -0
- data/lib/axi/AXI4/packet_partition/data_inf_partition.sv +72 -72
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.rb +2 -1
- data/lib/axi/AXI4/wide_axis_to_axi4_wr.sv +21 -21
- data/lib/axi/AXI_stream/axi_stream_split_channel.rb +7 -1
- data/lib/axi/AXI_stream/axi_stream_split_channel.sv +45 -40
- data/lib/axi/AXI_stream/axis_head_cut_verb.sv +6 -2
- data/lib/axi/AXI_stream/axis_head_cut_verc.sv +30 -30
- data/lib/axi/AXI_stream/axis_insert_copy.rb +18 -4
- data/lib/axi/AXI_stream/axis_insert_copy.sv +29 -16
- data/lib/axi/AXI_stream/axis_pipe_sync_seam.sv +9 -9
- data/lib/axi/AXI_stream/axis_rom_contect_sim.sv +38 -38
- data/lib/axi/AXI_stream/axis_sim_master_model.rb +30 -0
- data/lib/axi/AXI_stream/axis_sim_master_model.sv +46 -0
- data/lib/axi/AXI_stream/axis_sim_slaver_model.rb +26 -0
- data/lib/axi/AXI_stream/axis_sim_verify_by_coe.sv +101 -0
- data/lib/axi/AXI_stream/axis_split_channel_verb.rb +2 -0
- data/lib/axi/AXI_stream/axis_split_channel_verb.sv +4 -4
- data/lib/axi/common/common_ram_sim_wrapper.sv +10 -10
- data/lib/axi/common/common_ram_wrapper.sv +13 -13
- data/lib/axi/data_interface/data_inf_c/data_c_pipe_sync_seam.sv +27 -27
- data/lib/axi/data_interface/data_inf_c/data_c_sim_master_model.sv +72 -0
- data/lib/axi/data_interface/data_inf_c/data_c_sim_slaver_model.sv +58 -0
- data/lib/axi/data_interface/data_inf_c/logic_sim_model.sv +64 -0
- data/lib/axi/platform_ip/fifo_36kb_long.sv +1 -1
- data/lib/axi/techbench/tb_axi_stream_split_channel.rb +69 -0
- data/lib/axi/techbench/tb_axi_stream_split_channel.sv +150 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.rb +69 -0
- data/lib/axi/techbench/tb_axis_split_channel_verb.sv +125 -0
- data/lib/axi_tdl.rb +1 -0
- data/lib/axi_tdl/version.rb +1 -1
- data/lib/public_atom_module/CheckPClock.sv +53 -0
- data/lib/public_atom_module/LICENSE.md +674 -0
- data/lib/public_atom_module/altera_xilinx_always_block_sw.rb +57 -0
- data/lib/public_atom_module/bits_decode.sv +71 -0
- data/lib/public_atom_module/bits_decode_verb.sv +71 -0
- data/lib/public_atom_module/bits_decode_verb_sdl.rb +24 -0
- data/lib/public_atom_module/broaden.v +43 -0
- data/lib/public_atom_module/broaden_and_cross_clk.v +47 -0
- data/lib/public_atom_module/ceiling.v +39 -0
- data/lib/public_atom_module/ceiling_A1.v +42 -0
- data/lib/public_atom_module/clock_rst.sv +64 -0
- data/lib/public_atom_module/cross_clk_sync.v +37 -0
- data/lib/public_atom_module/edge_generator.v +50 -0
- data/lib/public_atom_module/flooring.v +36 -0
- data/lib/public_atom_module/latch_data.v +30 -0
- data/lib/public_atom_module/latency.v +48 -0
- data/lib/public_atom_module/latency_dynamic.v +83 -0
- data/lib/public_atom_module/latency_long.v +84 -0
- data/lib/public_atom_module/latency_verb.v +52 -0
- data/lib/public_atom_module/once_event.sv +65 -0
- data/lib/public_atom_module/pipe_reg.v +93 -0
- data/lib/public_atom_module/pipe_reg_2write_ports.v +84 -0
- data/lib/public_atom_module/sim/clock_rst_verb.sv +54 -0
- data/lib/public_atom_module/sim/latency_long_tb.sv +49 -0
- data/lib/public_atom_module/sim/latency_long_tb.sv.bak +49 -0
- data/lib/tdl/Logic/logic_edge.rb +1 -1
- data/lib/tdl/auto_script/autogensdl.rb +16 -5
- data/lib/tdl/axi4/axi4_interconnect_verb.rb +49 -10
- data/lib/tdl/basefunc.rb +1 -0
- data/lib/tdl/class_hdl/hdl_always_comb.rb +8 -4
- data/lib/tdl/class_hdl/hdl_always_ff.rb +49 -8
- data/lib/tdl/class_hdl/hdl_assign.rb +12 -4
- data/lib/tdl/class_hdl/hdl_block_ifelse.rb +18 -16
- data/lib/tdl/class_hdl/hdl_foreach.rb +4 -4
- data/lib/tdl/class_hdl/hdl_function.rb +8 -6
- data/lib/tdl/class_hdl/hdl_generate.rb +9 -5
- data/lib/tdl/class_hdl/hdl_initial.rb +36 -13
- data/lib/tdl/class_hdl/hdl_module_def.rb +27 -7
- data/lib/tdl/class_hdl/hdl_package.rb +45 -0
- data/lib/tdl/class_hdl/hdl_redefine_opertor.rb +117 -24
- data/lib/tdl/class_hdl/hdl_struct.rb +3 -3
- data/lib/tdl/class_hdl/hdl_verify.rb +1 -1
- data/lib/tdl/elements/Reset.rb +5 -9
- data/lib/tdl/elements/clock.rb +5 -9
- data/lib/tdl/elements/data_inf.rb +0 -17
- data/lib/tdl/elements/logic.rb +9 -31
- data/lib/tdl/elements/mail_box.rb +6 -1
- data/lib/tdl/elements/originclass.rb +23 -48
- data/lib/tdl/elements/parameter.rb +6 -7
- data/lib/tdl/examples/10_random/exp_random.sv +3 -3
- data/lib/tdl/examples/11_test_unit/dve.tcl +6 -0
- data/lib/tdl/examples/11_test_unit/exp_test_unit.rb +9 -8
- data/lib/tdl/examples/11_test_unit/exp_test_unit.sv +1 -1
- data/lib/tdl/examples/11_test_unit/exp_test_unit_sim.sv +9 -0
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.rb +6 -3
- data/lib/tdl/examples/11_test_unit/modules/sub_md0.sv +5 -5
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.rb +9 -4
- data/lib/tdl/examples/11_test_unit/modules/sub_md1.sv +5 -5
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit.sv +1 -2
- data/lib/tdl/examples/11_test_unit/tb_exp_test_unit_sim.sv +42 -0
- data/lib/tdl/examples/11_test_unit/tu0.sv +9 -9
- data/lib/tdl/examples/11_test_unit/tu1.sv +1 -1
- data/lib/tdl/examples/1_define_module/exmple_md.sv +13 -13
- data/lib/tdl/examples/2_hdl_class/tmp/always_comb_test.sv +60 -60
- data/lib/tdl/examples/2_hdl_class/tmp/always_ff_test.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/case_test.sv +17 -17
- data/lib/tdl/examples/2_hdl_class/tmp/head_pkg_module.sv +9 -9
- 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 +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/state_case_test.sv +10 -10
- data/lib/tdl/examples/2_hdl_class/tmp/test_foreach.sv +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_function.sv +7 -7
- data/lib/tdl/examples/2_hdl_class/tmp/test_initial_assert.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 +3 -3
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_port.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_module_var.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/test_package.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_package2.sv +4 -4
- data/lib/tdl/examples/2_hdl_class/tmp/test_struct_function.sv +2 -2
- data/lib/tdl/examples/2_hdl_class/tmp/test_vcs_string.sv +1 -1
- data/lib/tdl/examples/2_hdl_class/tmp/text_generate.sv +7 -7
- data/lib/tdl/examples/3_hdl_sdl_instance/main_md.sv +1 -1
- data/lib/tdl/examples/3_hdl_sdl_instance/sdl_md.sv +1 -1
- data/lib/tdl/examples/4_generate/test_generate.sv +11 -11
- data/lib/tdl/examples/5_logic_combin/test_logic_combin.sv +3 -3
- data/lib/tdl/examples/6_module_with_interface/inf_collect.sv +1 -1
- data/lib/tdl/examples/7_module_with_package/body_package.sv +1 -1
- data/lib/tdl/examples/7_module_with_package/example_pkg.sv +5 -5
- data/lib/tdl/examples/7_module_with_package/head_package.sv +1 -1
- 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 +29 -0
- data/lib/tdl/examples/8_top_module/test_top.sv +1 -1
- data/lib/tdl/examples/8_top_module/test_top_sim.sv +9 -0
- data/lib/tdl/examples/9_itegration/clock_manage/itgt_module_clock_manage.rb +13 -0
- data/lib/tdl/examples/9_itegration/clock_manage/test_clock_bb.sv +34 -0
- data/lib/tdl/examples/9_itegration/tb_test_top.sv +2 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop.sv +4 -2
- data/lib/tdl/examples/9_itegration/tb_test_tttop_sim.sv +39 -0
- data/lib/tdl/examples/9_itegration/test_top.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop.sv +4 -4
- data/lib/tdl/examples/9_itegration/test_tttop_sim.sv +9 -0
- data/lib/tdl/examples/9_itegration/top.rb +1 -0
- data/lib/tdl/exlib/axis_eth_ex.rb +95 -0
- data/lib/tdl/exlib/axis_verify.rb +265 -0
- data/lib/tdl/exlib/clock_reset_verify.rb +29 -0
- data/lib/tdl/exlib/dve_tcl.rb +30 -11
- data/lib/tdl/exlib/itegration.rb +15 -3
- data/lib/tdl/exlib/itegration_verb.rb +167 -130
- data/lib/tdl/exlib/logic_verify.rb +88 -0
- data/lib/tdl/exlib/test_point.rb +96 -94
- data/lib/tdl/exlib/test_point.rb.bak +293 -0
- data/lib/tdl/rebuild_ele/ele_base.rb +9 -9
- data/lib/tdl/sdlmodule/sdlmodlule_path_db.rb +34 -0
- data/lib/tdl/sdlmodule/sdlmodule.rb +79 -65
- data/lib/tdl/sdlmodule/sdlmodule_arraychain.rb +1 -1
- data/lib/tdl/sdlmodule/sdlmodule_draw.rb +81 -16
- data/lib/tdl/sdlmodule/sdlmodule_instance.rb +3 -0
- data/lib/tdl/sdlmodule/sdlmodule_port_define.rb +6 -6
- data/lib/tdl/sdlmodule/sdlmodule_varible.rb +6 -6
- data/lib/tdl/sdlmodule/test_unit_module.rb +283 -33
- data/lib/tdl/sdlmodule/test_unit_module.rb.bak +143 -0
- data/lib/tdl/sdlmodule/top_module.rb +62 -58
- data/lib/tdl/sdlmodule/top_module.rb.bak +547 -0
- data/lib/tdl/tdl.rb +18 -3
- data/lib/tdl/tdlerror/tdlerror.rb +1 -1
- metadata +54 -121
- data/CODE_OF_CONDUCT.md +0 -74
- data/lib/axi/AXI_stream/axis_length_split_writh_user.sv +0 -87
@@ -0,0 +1,37 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version:
|
8
|
+
creaded: 2015/5/8 17:05:00
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module cross_clk_sync #(
|
13
|
+
parameter LAT = 2,
|
14
|
+
parameter DSIZE = 1
|
15
|
+
)(
|
16
|
+
input clk,
|
17
|
+
input rst_n,
|
18
|
+
input [DSIZE-1:0] d,
|
19
|
+
output[DSIZE-1:0] q
|
20
|
+
);
|
21
|
+
|
22
|
+
reg [DSIZE-1:0] ltc [LAT-1:0];
|
23
|
+
|
24
|
+
always@(posedge clk/*,negedge rst_n*/)begin:GEN_LAT
|
25
|
+
integer II;
|
26
|
+
if(~rst_n)begin
|
27
|
+
for(II=0;II<LAT;II=II+1)
|
28
|
+
ltc[II] <= {DSIZE{1'b0}};
|
29
|
+
end else begin
|
30
|
+
ltc[0] <= d;
|
31
|
+
for(II=1;II<LAT;II=II+1)
|
32
|
+
ltc[II] <= ltc[II-1];
|
33
|
+
end end
|
34
|
+
|
35
|
+
assign q = ltc[LAT-1];
|
36
|
+
|
37
|
+
endmodule
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version:
|
8
|
+
creaded:
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
module edge_generator #(
|
12
|
+
parameter MODE = "NORMAL" // FAST NORMAL BEST
|
13
|
+
)(
|
14
|
+
input clk,
|
15
|
+
input rst_n,
|
16
|
+
input in,
|
17
|
+
output raising,
|
18
|
+
output falling
|
19
|
+
);
|
20
|
+
|
21
|
+
reg in_d0;
|
22
|
+
reg in_d1;
|
23
|
+
reg raising_reg;
|
24
|
+
reg falling_reg;
|
25
|
+
|
26
|
+
always@(posedge clk/*,negedge rst_n*/)begin
|
27
|
+
if(~rst_n)begin
|
28
|
+
in_d0 <= 1'b0;
|
29
|
+
in_d1 <= 1'b0;
|
30
|
+
raising_reg <= 1'b0;
|
31
|
+
falling_reg <= 1'b0;
|
32
|
+
end else begin
|
33
|
+
in_d0 <= in;
|
34
|
+
in_d1 <= in_d0;
|
35
|
+
if(MODE == "NORMAL")begin
|
36
|
+
raising_reg <= {in_d0,in} == 2'b01 ;
|
37
|
+
falling_reg <= {in_d0,in} == 2'b10 ;
|
38
|
+
end else if(MODE == "BEST")begin
|
39
|
+
raising_reg <= {in_d1,in_d0} == 2'b01 ;
|
40
|
+
falling_reg <= {in_d1,in_d0} == 2'b10 ;
|
41
|
+
end else begin
|
42
|
+
raising_reg <= 1'b0;
|
43
|
+
falling_reg <= 1'b0;
|
44
|
+
end end end
|
45
|
+
|
46
|
+
|
47
|
+
assign raising = (MODE == "FAST")? {in_d0,in} == 2'b01 : raising_reg;
|
48
|
+
assign falling = (MODE == "FAST")? {in_d0,in} == 2'b10 : falling_reg;
|
49
|
+
|
50
|
+
endmodule
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded: 2015/7/23 13:56:28
|
9
|
+
madified:2015/10/30 10:56:34
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module flooring #(
|
13
|
+
parameter DSIZE = 16,
|
14
|
+
parameter CSIZE = 4, //must smaller than DSIZE
|
15
|
+
parameter OSIZE = 8, //must not bigger than DSIZE-CSIZE
|
16
|
+
parameter SEQUENTIAL = "TRUE"
|
17
|
+
)(
|
18
|
+
input clock ,
|
19
|
+
input [DSIZE-1:0] indata ,
|
20
|
+
output[OSIZE-1:0] outdata
|
21
|
+
);
|
22
|
+
|
23
|
+
|
24
|
+
reg [OSIZE-1:0] result;
|
25
|
+
wire[OSIZE-1:0] cm_result;
|
26
|
+
|
27
|
+
assign cm_result = (indata[DSIZE-1-:CSIZE] == {CSIZE{1'b0}})? indata[DSIZE-1-CSIZE-:OSIZE] : {OSIZE{1'b1}};
|
28
|
+
|
29
|
+
always@(posedge clock)
|
30
|
+
result <= cm_result;
|
31
|
+
|
32
|
+
|
33
|
+
assign outdata = (SEQUENTIAL == "TRUE")? result : (SEQUENTIAL == "FALSE")? cm_result : {OSIZE{1'b0}};
|
34
|
+
|
35
|
+
endmodule
|
36
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded: 2015/6/5 17:26:19
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module latch_data #(
|
13
|
+
parameter DSIZE = 8
|
14
|
+
)(
|
15
|
+
input enable,
|
16
|
+
input [DSIZE-1:0] in,
|
17
|
+
output[DSIZE-1:0] out
|
18
|
+
);
|
19
|
+
|
20
|
+
|
21
|
+
reg [DSIZE-1:0] data;
|
22
|
+
|
23
|
+
always@(enable)
|
24
|
+
if(enable)
|
25
|
+
data = in;
|
26
|
+
else data = data;
|
27
|
+
|
28
|
+
assign out = data;
|
29
|
+
|
30
|
+
endmodule
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERA.0.1 : 2015/12/25 15:53:03
|
8
|
+
supply LAT = 0
|
9
|
+
creaded: 2015/5/8 17:05:00
|
10
|
+
madified:
|
11
|
+
***********************************************/
|
12
|
+
`timescale 1ns/1ps
|
13
|
+
module latency #(
|
14
|
+
parameter LAT = 2,
|
15
|
+
parameter DSIZE = 1
|
16
|
+
)(
|
17
|
+
input clk,
|
18
|
+
input rst_n,
|
19
|
+
input [DSIZE-1:0] d,
|
20
|
+
output[DSIZE-1:0] q
|
21
|
+
);
|
22
|
+
|
23
|
+
reg [DSIZE-1:0] ltc [LAT-1:0];
|
24
|
+
|
25
|
+
generate
|
26
|
+
if(LAT > 0)begin
|
27
|
+
always@(posedge clk/*,negedge rst_n*/)begin:GEN_LAT
|
28
|
+
integer II;
|
29
|
+
if(~rst_n)begin
|
30
|
+
for(II=0;II<LAT;II=II+1)
|
31
|
+
ltc[II] <= {DSIZE{1'b0}};
|
32
|
+
end else begin
|
33
|
+
ltc[0] <= d;
|
34
|
+
for(II=1;II<LAT;II=II+1)
|
35
|
+
ltc[II] <= ltc[II-1];
|
36
|
+
end end
|
37
|
+
|
38
|
+
assign q = ltc[LAT-1];
|
39
|
+
|
40
|
+
end else begin
|
41
|
+
|
42
|
+
assign q = d;
|
43
|
+
|
44
|
+
end
|
45
|
+
endgenerate
|
46
|
+
|
47
|
+
|
48
|
+
endmodule
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded: 2016/4/1 上午10:45:19
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module latency_dynamic #(
|
13
|
+
parameter LSIZE = 10
|
14
|
+
)(
|
15
|
+
input clk ,
|
16
|
+
input rst_n ,
|
17
|
+
input [LSIZE-1:0] lat ,
|
18
|
+
input d ,
|
19
|
+
output q
|
20
|
+
);
|
21
|
+
|
22
|
+
wire clock;
|
23
|
+
assign clock = clk;
|
24
|
+
|
25
|
+
wire d_falling;
|
26
|
+
wire d_raising;
|
27
|
+
|
28
|
+
edge_generator #(
|
29
|
+
.MODE ("FAST") // FAST NORMAL BEST
|
30
|
+
)edge_generator_inst(
|
31
|
+
.clk (clock ),
|
32
|
+
.rst_n (rst_n ),
|
33
|
+
.in (d ),
|
34
|
+
.raising (d_raising ),
|
35
|
+
.falling (d_falling )
|
36
|
+
);
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
reg [LSIZE-1:0] fedge_cnt;
|
41
|
+
reg [LSIZE-1:0] redge_cnt;
|
42
|
+
|
43
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
44
|
+
if(~rst_n) fedge_cnt <= {LSIZE{1'b0}};
|
45
|
+
else begin
|
46
|
+
if(fedge_cnt == {LSIZE{1'b0}})begin
|
47
|
+
if(d_falling)
|
48
|
+
fedge_cnt <= 10'd1;
|
49
|
+
else fedge_cnt <= {LSIZE{1'b0}};
|
50
|
+
end else begin
|
51
|
+
if(fedge_cnt == lat-1'b1)
|
52
|
+
fedge_cnt <= {LSIZE{1'b0}};
|
53
|
+
else fedge_cnt <= fedge_cnt + 1'd1;
|
54
|
+
end end end
|
55
|
+
|
56
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
57
|
+
if(~rst_n) redge_cnt <= {LSIZE{1'b0}};
|
58
|
+
else begin
|
59
|
+
if(redge_cnt == {LSIZE{1'b0}})begin
|
60
|
+
if(d_raising)
|
61
|
+
redge_cnt <= 10'd1;
|
62
|
+
else redge_cnt <= {LSIZE{1'b0}};
|
63
|
+
end else begin
|
64
|
+
if(redge_cnt == lat-1'b1)
|
65
|
+
redge_cnt <= {LSIZE{1'b0}};
|
66
|
+
else redge_cnt <= redge_cnt + 1'd1;
|
67
|
+
end end end
|
68
|
+
|
69
|
+
reg q_reg;
|
70
|
+
|
71
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
72
|
+
if(~rst_n) q_reg <= 1'b0;
|
73
|
+
else if(fedge_cnt == lat-1'b1)
|
74
|
+
q_reg <= 1'b0;
|
75
|
+
else if(redge_cnt == lat-1'b1)
|
76
|
+
q_reg <= 1'b1;
|
77
|
+
else q_reg <= q_reg;
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
assign q = q_reg;
|
82
|
+
|
83
|
+
endmodule
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERA.0.0
|
8
|
+
creaded: 2015/12/1 13:44:09
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module latency_long #(
|
13
|
+
parameter LAT = 100
|
14
|
+
)(
|
15
|
+
input clock ,
|
16
|
+
input rst_n ,
|
17
|
+
input d ,
|
18
|
+
output q
|
19
|
+
);
|
20
|
+
|
21
|
+
wire d_falling;
|
22
|
+
wire d_raising;
|
23
|
+
|
24
|
+
edge_generator #(
|
25
|
+
.MODE ("FAST") // FAST NORMAL BEST
|
26
|
+
)edge_generator_inst(
|
27
|
+
.clk (clock ),
|
28
|
+
.rst_n (rst_n ),
|
29
|
+
.in (d ),
|
30
|
+
.raising (d_raising ),
|
31
|
+
.falling (d_falling )
|
32
|
+
);
|
33
|
+
|
34
|
+
|
35
|
+
localparam PLAT = LAT-1;
|
36
|
+
localparam DSIZE = (LAT<=64)? 6 : (LAT<=128)? 7 : (LAT<=256)? 8 :
|
37
|
+
(LAT<=512)? 9 : (LAT<=1024)? 10 : (LAT<=2048)? 11 : (LAT<=4096)? 12 : 32;
|
38
|
+
|
39
|
+
reg [DSIZE-1:0] fedge_cnt;
|
40
|
+
reg [DSIZE-1:0] redge_cnt;
|
41
|
+
|
42
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
43
|
+
if(~rst_n) fedge_cnt <= {DSIZE{1'b0}};
|
44
|
+
else begin
|
45
|
+
if(fedge_cnt == {DSIZE{1'b0}})begin
|
46
|
+
if(d_falling)
|
47
|
+
fedge_cnt <= 10'd1;
|
48
|
+
else fedge_cnt <= {DSIZE{1'b0}};
|
49
|
+
end else begin
|
50
|
+
if(fedge_cnt == PLAT)
|
51
|
+
fedge_cnt <= {DSIZE{1'b0}};
|
52
|
+
else fedge_cnt <= fedge_cnt + 1'd1;
|
53
|
+
end end end
|
54
|
+
|
55
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
56
|
+
if(~rst_n) redge_cnt <= {DSIZE{1'b0}};
|
57
|
+
else begin
|
58
|
+
if(redge_cnt == {DSIZE{1'b0}})begin
|
59
|
+
if(d_raising)
|
60
|
+
redge_cnt <= 10'd1;
|
61
|
+
else redge_cnt <= {DSIZE{1'b0}};
|
62
|
+
end else begin
|
63
|
+
if(redge_cnt == PLAT)
|
64
|
+
redge_cnt <= {DSIZE{1'b0}};
|
65
|
+
else redge_cnt <= redge_cnt + 1'd1;
|
66
|
+
end end end
|
67
|
+
|
68
|
+
reg q_reg;
|
69
|
+
|
70
|
+
always@(posedge clock/*,negedge rst_n*/)begin
|
71
|
+
if(~rst_n) q_reg <= 1'b0;
|
72
|
+
else if(fedge_cnt == PLAT)
|
73
|
+
q_reg <= 1'b0;
|
74
|
+
else if(redge_cnt == PLAT)
|
75
|
+
q_reg <= 1'b1;
|
76
|
+
else q_reg <= q_reg;
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
assign q = q_reg;
|
81
|
+
|
82
|
+
endmodule
|
83
|
+
|
84
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version: VERB.0.0 :2015/12/1 15:06:34
|
8
|
+
optimize long latency
|
9
|
+
creaded: 2015/12/1 15:05:58
|
10
|
+
madified:
|
11
|
+
***********************************************/
|
12
|
+
`timescale 1ns/1ps
|
13
|
+
module latency_verb #(
|
14
|
+
parameter LAT = 10,
|
15
|
+
parameter DSIZE = 1
|
16
|
+
)(
|
17
|
+
input clk ,
|
18
|
+
input rst_n ,
|
19
|
+
input [DSIZE-1:0] d ,
|
20
|
+
output[DSIZE-1:0] q
|
21
|
+
);
|
22
|
+
|
23
|
+
genvar II;
|
24
|
+
|
25
|
+
generate
|
26
|
+
if(LAT<40)begin
|
27
|
+
latency #(
|
28
|
+
.LAT (LAT ),
|
29
|
+
.DSIZE (DSIZE )
|
30
|
+
)lat_int(
|
31
|
+
.clk (clk ),
|
32
|
+
.rst_n (rst_n ),
|
33
|
+
.d (d ),
|
34
|
+
.q (q )
|
35
|
+
);
|
36
|
+
end else begin
|
37
|
+
for(II=0;II<DSIZE;II=II+1)begin:FOR_BLOCK
|
38
|
+
latency_long #(
|
39
|
+
.LAT (LAT )
|
40
|
+
)lat_int(
|
41
|
+
.clock (clk ),
|
42
|
+
.rst_n (rst_n ),
|
43
|
+
.d (d[II] ),
|
44
|
+
.q (q[II] )
|
45
|
+
);
|
46
|
+
end
|
47
|
+
end
|
48
|
+
endgenerate
|
49
|
+
|
50
|
+
endmodule
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/**********************************************
|
2
|
+
______________ ______________
|
3
|
+
______________ \ /\ /|\ /| ______________
|
4
|
+
______________ \/ \/ | \/ | ______________
|
5
|
+
descript:
|
6
|
+
author : Young
|
7
|
+
Version:
|
8
|
+
creaded: xxxx.xx.xx
|
9
|
+
madified:
|
10
|
+
***********************************************/
|
11
|
+
`timescale 1ns/1ps
|
12
|
+
module once_event #(
|
13
|
+
parameter MODE = "BOTH" //RAISE FALL
|
14
|
+
)(
|
15
|
+
input clock,
|
16
|
+
input rst_n,
|
17
|
+
input signal,
|
18
|
+
output logic trigger
|
19
|
+
);
|
20
|
+
|
21
|
+
logic signal_raising;
|
22
|
+
logic signal_falling;
|
23
|
+
|
24
|
+
edge_generator edge_generator_inst(
|
25
|
+
/*input */ .clk (clock ),
|
26
|
+
/*input */ .rst_n (rst_n ),
|
27
|
+
/*input */ .in (signal ),
|
28
|
+
/*output */ .raising (signal_raising ),
|
29
|
+
/*output */ .falling (signal_falling )
|
30
|
+
);
|
31
|
+
|
32
|
+
logic raising;
|
33
|
+
logic falling;
|
34
|
+
|
35
|
+
always_comb begin
|
36
|
+
if(MODE=="BOTH" || MODE=="RAISE")
|
37
|
+
raising = signal_raising;
|
38
|
+
else raising = 1'b0;
|
39
|
+
end
|
40
|
+
|
41
|
+
always_comb begin
|
42
|
+
if(MODE=="BOTH" || MODE=="FALL")
|
43
|
+
falling = signal_falling;
|
44
|
+
else falling = 1'b0;
|
45
|
+
end
|
46
|
+
|
47
|
+
always@(posedge clock,negedge rst_n)begin:TRIGGER_RECORD_BLOCK
|
48
|
+
logic record;
|
49
|
+
if(~rst_n)begin
|
50
|
+
record <= 1'b0;
|
51
|
+
trigger <= 1'b0;
|
52
|
+
end else begin
|
53
|
+
if(raising || falling)
|
54
|
+
record <= 1'b1;
|
55
|
+
else record <= record;
|
56
|
+
|
57
|
+
if(record)
|
58
|
+
trigger <= 1'b0;
|
59
|
+
else if(raising || falling)
|
60
|
+
trigger <= 1'b1;
|
61
|
+
else trigger <= 1'b0;
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
endmodule
|