@@ -2673,6 +2673,9 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
26732673 clk_ext_strs .add (clk_ext_str_i )
26742674 if len (clk_ext_strs ) > 1 :
26752675 flow_control_is_async = True
2676+ # Need to know syn tool for what type of CDC to render
2677+ if SYN .SYN_TOOL is None :
2678+ SYN .PART_SET_TOOL (parser_state .part )
26762679 write_size , read_size = parser_state .clk_cross_var_info [
26772680 var_name
26782681 ].write_read_sizes
@@ -2688,13 +2691,6 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
26882691
26892692 # TODO OTHER SIZES
26902693 if flow_control :
2691- if SYN .SYN_TOOL is None :
2692- SYN .PART_SET_TOOL (parser_state .part )
2693- if flow_control_is_async and SYN .SYN_TOOL is not VIVADO :
2694- raise Exception (
2695- "Async fifos are only implemented for Xilinx parts, TODO!" , var_name
2696- )
2697-
26982694 if write_size != read_size :
26992695 raise Exception (
27002696 "Only equal read and write sizes for async fifos for now, TODO!" ,
@@ -2729,7 +2725,7 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
27292725 print ("More than 1 dim for async flow control!?" , var_name )
27302726 sys .exit (- 1 )
27312727 depth = dims [0 ]
2732- if flow_control_is_async and depth < 16 :
2728+ if flow_control_is_async and SYN . SYN_TOOL is VIVADO and depth < 16 :
27332729 depth = 16
27342730 print (
27352731 "WARNING:" ,
@@ -2749,7 +2745,7 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
27492745use work.c_structs_pkg.all; -- User types
27502746"""
27512747
2752- if flow_control and flow_control_is_async :
2748+ if flow_control and flow_control_is_async and SYN . SYN_TOOL is VIVADO :
27532749 text += """
27542750library xpm;
27552751use xpm.vcomponents.all;
@@ -2938,7 +2934,7 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
29382934 + """dout_slv"""
29392935 + from_slv_toks [1 ]
29402936 + """;""" )
2941- if flow_control and flow_control_is_async :
2937+ if flow_control and flow_control_is_async and SYN . SYN_TOOL is VIVADO :
29422938 text += (
29432939 """
29442940wr_power_on_reset <= '0' when rising_edge(in_clk);
@@ -3079,21 +3075,34 @@ def WRITE_CLK_CROSS_ENTITIES(parser_state, multimain_timing_params):
30793075-- End of xpm_fifo_async_inst instantiation
30803076"""
30813077 )
3082-
3083- # Sync built in fifo
3084- elif flow_control and not flow_control_is_async :
3078+ # Built in fifo sync or async looks similar
3079+ elif flow_control :
3080+ text += """
3081+ pipelinec_fifo_fwft_inst : entity work."""
3082+ if not flow_control_is_async :
3083+ text += "pipelinec_fifo_fwft"
3084+ else :
3085+ text += "pipelinec_async_fifo_fwft"
30853086 text += """
3086- pipelinec_fifo_fwft_inst : entity work.pipelinec_fifo_fwft
30873087generic map (
30883088 DEPTH_LOG2 => """ + str (math .ceil (math .log (depth , 2 ))) + """,
30893089 DATA_WIDTH => """ + C_TYPE_STR_TO_VHDL_SLV_LEN_STR (in_t , parser_state ) + """
30903090)
30913091port map
30923092(
3093- clk => in_clk,
3093+ """
3094+ if flow_control_is_async :
3095+ text += " in_clk => in_clk,\n "
3096+ else :
3097+ text += " clk => in_clk,\n "
3098+ text += """
30943099 valid_in => write_enable(0) and in_clk_en(0),
30953100 ready_out => wr_return_output.ready(0),
30963101 data_in => din_slv,
3102+ """
3103+ if flow_control_is_async :
3104+ text += " out_clk => out_clk,\n "
3105+ text += """
30973106 valid_out => rd_return_output.valid(0),
30983107 ready_in => read_enable(0) and out_clk_en(0),
30993108 data_out => dout_slv
0 commit comments