diff --git a/TrackletGraph.py b/TrackletGraph.py index 4c6c212..28db3dc 100644 --- a/TrackletGraph.py +++ b/TrackletGraph.py @@ -233,7 +233,7 @@ def populate_bitwidths(mem,hls_dir): # FIXME this information should be parsed f if barrelPS>-1 or barrel2S>-1: mem.bitwidth = 52 if disk>-1: mem.bitwidth = 55 elif mem.mtype == "TrackWord": - mem.bitwidth = 104 + mem.bitwidth = 113 elif mem.mtype == "BarrelStubWord": mem.bitwidth = 46 elif mem.mtype == "DiskStubWord": @@ -504,7 +504,7 @@ def split_track_fit_streams(p_dict, m_dict): for up_m in up_p.upstreams: if up_m.mtype != "FullMatch": continue - layer = up_m.inst.split("_")[-1][0:2] + layer = up_m.inst.split("_")[2][0:2] assert(layer.startswith("L") or layer.startswith("D")) layers.add(layer) diff --git a/WriteVHDLSyntax.py b/WriteVHDLSyntax.py index 1d3df4a..4b22e53 100644 --- a/WriteVHDLSyntax.py +++ b/WriteVHDLSyntax.py @@ -825,7 +825,7 @@ def writeControlSignals_interface(initial_proc, final_procs, notfinal_procs, del string_ctrl_signals += " "+final_proc_short+"_bx_out : out std_logic_vector(2 downto 0);\n" string_ctrl_signals += " "+final_proc_short+"_bx_out_vld : out std_logic;\n" string_ctrl_signals += " "+final_proc_short+"_done : out std_logic;\n" - if final_proc_short == "FT": + if final_proc_short == "TB": for final_proc in final_procs: string_ctrl_signals += " "+final_proc+"_last_track : out std_logic;\n" string_ctrl_signals += " "+final_proc+"_last_track_vld : out std_logic;\n" @@ -1071,7 +1071,7 @@ def writeTBControlSignals(memDict, memInfoDict, initial_proc, final_procs, notfi string_ctrl_signals += (" signal "+final_procs[-1].mtype_short()+"_bx_out").ljust(str_len)+": std_logic_vector(2 downto 0) := (others => '1');\n" string_ctrl_signals += (" signal "+final_procs[-1].mtype_short()+"_bx_out_vld").ljust(str_len)+": std_logic := '0';\n" string_ctrl_signals += (" signal "+final_procs[-1].mtype_short()+"_done").ljust(str_len)+": std_logic := '0';\n" - if final_procs[-1].mtype_short().startswith("FT"): + if final_procs[-1].mtype_short().startswith("TB"): for final_proc in final_procs: string_ctrl_signals += (" signal "+final_proc.inst+"_last_track").ljust(str_len)+": std_logic := '0';\n" string_ctrl_signals += (" signal "+final_proc.inst+"_last_track_vld").ljust(str_len)+": std_logic := '0';\n" @@ -1219,7 +1219,7 @@ def writeFWBlockInstance(topfunc, memDict, memInfoDict, initial_proc, final_proc string_fwblock_inst += (" " + final_procs[-1].mtype_short() + "_bx_out").ljust(str_len) + "=> " + final_procs[-1].mtype_short() + "_bx_out,\n" string_fwblock_inst += (" " + final_procs[-1].mtype_short() + "_bx_out_vld").ljust(str_len) + "=> " + final_procs[-1].mtype_short() + "_bx_out_vld,\n" string_fwblock_inst += (" " + final_procs[-1].mtype_short() + "_done").ljust(str_len) + "=> " + final_procs[-1].mtype_short() + "_done,\n" - if final_procs[-1].mtype_short().startswith("FT"): + if final_procs[-1].mtype_short().startswith("TB"): for final_proc in final_procs : string_fwblock_inst += (" " + final_proc.inst + "_last_track").ljust(str_len) + "=> " + final_proc.inst + "_last_track,\n" string_fwblock_inst += (" " + final_proc.inst + "_last_track_vld").ljust(str_len) + "=> " + final_proc.inst + "_last_track_vld,\n" @@ -1643,7 +1643,7 @@ def writeProcBXPort(modName,isInput,isInitial,first_of_type,delay): else: if first_of_type and not ("VMSMER" in modName or "PC" in modName): bx_str += " bx_o_V => "+modName.split("_")[0]+"_bx_out,\n" - if ("FT_" in modName) or ("TP_" in modName): + if ("TB_" in modName) or ("TP_" in modName): bx_str += " bx_o_V_ap_vld => "+modName.split("_")[0]+"_bx_out_vld,\n" else: bx_str += " bx_o_V_ap_vld => open,\n" diff --git a/bodge/TF_D1D2_tb_writer.vhd.bodge b/bodge/TF_D1D2_tb_writer.vhd.bodge deleted file mode 100644 index bc24144..0000000 --- a/bodge/TF_D1D2_tb_writer.vhd.bodge +++ /dev/null @@ -1,16 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L1L2. - -- (Needed to compare with emData/). - writeTF_D1D2_297 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&memory_enum_to_string(D1D2)&outputFileNameEnding, - FIFO_WIDTH => 297 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_D1D2_stream_A_write and TW_D1D2_stream_AV_din(103)), - FULL_NEG => TW_D1D2_stream_A_full_neg, - --DATA => TW_D1D2_stream_AV_din&BW_D1D2_L1_stream_AV_din&BW_D1D2_D3_stream_AV_din&BW_D1D2_D4_stream_AV_din&BW_D1D2_D5_stream_AV_din - DATA => TW_D1D2_stream_AV_din&BW_D1D2_L1_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_D3D4_tb_writer.vhd.bodge b/bodge/TF_D3D4_tb_writer.vhd.bodge deleted file mode 100644 index 57b27eb..0000000 --- a/bodge/TF_D3D4_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L1L2. - -- (Needed to compare with emData/). - writeTF_D3D4_297 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&memory_enum_to_string(D3D4)&outputFileNameEnding, - FIFO_WIDTH => 297 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_D3D4_stream_A_write and TW_D3D4_stream_AV_din(103)), - FULL_NEG => TW_D3D4_stream_A_full_neg, - DATA => TW_D3D4_stream_AV_din&BW_D3D4_L1_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L1D1_tb_writer.vhd.bodge b/bodge/TF_L1D1_tb_writer.vhd.bodge deleted file mode 100644 index 2072b44..0000000 --- a/bodge/TF_L1D1_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L1L2. - -- (Needed to compare with emData/). - writeTF_L1D1_300 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&memory_enum_to_string(L1D1)&outputFileNameEnding, - FIFO_WIDTH => 300 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L1D1_stream_A_write and TW_L1D1_stream_AV_din(103)), - FULL_NEG => TW_L1D1_stream_A_full_neg, - DATA => TW_L1D1_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L1L2_tb_writer.vhd.bodge b/bodge/TF_L1L2_tb_writer.vhd.bodge deleted file mode 100644 index 0e88c66..0000000 --- a/bodge/TF_L1L2_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L1L2. - -- (Needed to compare with emData/). - writeTF_L1L2_484 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&"L1L2"&outputFileNameEnding, - FIFO_WIDTH => 484 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L1L2_stream_A_write and TW_L1L2_stream_AV_din(103)), - FULL_NEG => TW_L1L2_stream_A_full_neg, - DATA => TW_L1L2_stream_AV_din&BW_L1L2_L3_stream_AV_din&BW_L1L2_L4_stream_AV_din&BW_L1L2_L5_stream_AV_din&BW_L1L2_L6_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L2D1_tb_writer.vhd.bodge b/bodge/TF_L2D1_tb_writer.vhd.bodge deleted file mode 100644 index 5d07e40..0000000 --- a/bodge/TF_L2D1_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L1L2. - -- (Needed to compare with emData/). - writeTF_L2D1_346 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&memory_enum_to_string(L2D1)&outputFileNameEnding, - FIFO_WIDTH => 346 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L2D1_stream_A_write and TW_L2D1_stream_AV_din(103)), - FULL_NEG => TW_L2D1_stream_A_full_neg, - DATA => TW_L2D1_stream_AV_din&BW_L2D1_L1_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L2L3_tb_writer.vhd.bodge b/bodge/TF_L2L3_tb_writer.vhd.bodge deleted file mode 100644 index 402b6e1..0000000 --- a/bodge/TF_L2L3_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L2L3. - -- (Needed to compare with emData/). - writeTF_L2L3_438 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&"L2L3"&outputFileNameEnding, - FIFO_WIDTH => 438 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L2L3_stream_A_write and TW_L2L3_stream_AV_din(103)), - FULL_NEG => TW_L2L3_stream_A_full_neg, - DATA => TW_L2L3_stream_AV_din&BW_L2L3_L1_stream_AV_din&BW_L2L3_L4_stream_AV_din&BW_L2L3_L5_stream_AV_din&emptyDiskStub&emptyDiskStub&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L3L4_tb_writer.vhd.bodge b/bodge/TF_L3L4_tb_writer.vhd.bodge deleted file mode 100644 index c3b994b..0000000 --- a/bodge/TF_L3L4_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L3L4. - -- (Needed to compare with emData/). - writeTF_L3L4_386 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&"L3L4"&outputFileNameEnding, - FIFO_WIDTH => 386 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L3L4_stream_A_write and TW_L3L4_stream_AV_din(103)), - FULL_NEG => TW_L3L4_stream_A_full_neg, - DATA => TW_L3L4_stream_AV_din&BW_L3L4_L1_stream_AV_din&BW_L3L4_L2_stream_AV_din&BW_L3L4_L5_stream_AV_din&BW_L3L4_L6_stream_AV_din&emptyDiskStub&emptyDiskStub - ); - diff --git a/bodge/TF_L5L6_tb_writer.vhd.bodge b/bodge/TF_L5L6_tb_writer.vhd.bodge deleted file mode 100644 index 5196fa0..0000000 --- a/bodge/TF_L5L6_tb_writer.vhd.bodge +++ /dev/null @@ -1,15 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data for L5L6. - -- (Needed to compare with emData/). - writeTF_L5L6_288 : entity work.FileWriterFIFO - generic map ( - FILE_NAME => FILE_OUT_TF&"L5L6"&outputFileNameEnding, - FIFO_WIDTH => 288 - ) - port map ( - CLK => CLK, - DONE => FT_DONE, - WRITE_EN => (TW_L5L6_stream_A_write and TW_L5L6_stream_AV_din(103)), - FULL_NEG => TW_L5L6_stream_A_full_neg, - DATA => TW_L5L6_stream_AV_din&BW_L5L6_L1_stream_AV_din&BW_L5L6_L2_stream_AV_din&BW_L5L6_L3_stream_AV_din&BW_L5L6_L4_stream_AV_din - ); - diff --git a/bodge/TF_tb_constants.vhd.bodge b/bodge/TF_tb_constants.vhd.bodge deleted file mode 100644 index 14c8155..0000000 --- a/bodge/TF_tb_constants.vhd.bodge +++ /dev/null @@ -1,6 +0,0 @@ - -- A bodge for TrackBuilder to write TF concatenated track+stub data. - -- (Needed to compare with emData/). - constant FILE_OUT_TF : string := dataOutDir&"TF_"; - -- Empty field in the output from barrel-only TrackBuilders corresponding to - -- disk matches - constant emptyDiskStub : std_logic_vector(48 downto 0) := (others => '0'); diff --git a/generator_hdl.py b/generator_hdl.py index 66ee73b..42d93a9 100755 --- a/generator_hdl.py +++ b/generator_hdl.py @@ -290,16 +290,27 @@ def writeTBMemoryWrites(memDict, memInfoDict, notfinal_procs,split, MPARdict): if memInfo.isFIFO: string_tmp = writeTBMemoryWriteFIFOInstance(mtypeB, memDict, proc) - # A bodge for TrackBuilder to write TF concatenated track+stub data. + # Code for TrackBuilder to write TF concatenated track+stub data. # (Needed to compare with emData/). - if mtypeB == 'TW_104': + if mtypeB == 'TW_113': for m in memDict[mtypeB]: memName = m.inst seed = memName[-4:] - fileTF = open("bodge/TF_" + seed + "_tb_writer.vhd.bodge") - string_tmp += fileTF.read(); - fileTF.close() - + string_tmp += "-- Clode for TrackBuilder to write TF concatenated track+stub data.\n"; + string_tmp += "-- (Needed to compare with emData/).\n"; + string_tmp += "writeTF_"+seed+"_634 : entity work.FileWriterFIFO\n"; + string_tmp += "generic map (\n"; + string_tmp += " FILE_NAME => FILE_OUT_TF&\""+seed+"\"&outputFileNameEnding,\n"; + string_tmp += " FIFO_WIDTH => 634\n"; + string_tmp += ")\n"; + string_tmp += "port map (\n"; + string_tmp += " CLK => CLK,\n" + string_tmp += " DONE => TB_DONE,\n"; + string_tmp += " WRITE_EN => (TW_"+seed+"_stream_A_write and TW_"+seed+"_stream_AV_din(112)),\n"; + string_tmp += " FULL_NEG => TW_"+seed+"_stream_A_full_neg,\n"; + string_tmp += " DATA => TW_"+seed+"_stream_AV_din&BW_"+seed+"_L1_stream_AV_din&BW_"+seed+"_L2_stream_AV_din&BW_"+seed+"_L3_stream_AV_din&BW_"+seed+"_L4_stream_AV_din&BW_"+seed+"_L5_stream_AV_din&BW_"+seed+"_L6_stream_AV_din&DW_"+seed+"_D1_stream_AV_din&DW_"+seed+"_D2_stream_AV_din&DW_"+seed+"_D3_stream_AV_din&DW_"+seed+"_D4_stream_AV_din&DW_"+seed+"_D5_stream_AV_din\n"; + string_tmp += ");\n"; + if memInfo.is_final: if memInfo.isFIFO: string_final += string_tmp @@ -355,12 +366,9 @@ def writeTestBench(tbfunc, topfunc, process_list, memDict, memInfoDict, memPrint string_header += writeTBOpener(tbfunc) string_constants = writeTBConstants(memDict, memInfoDict, notfinal_procs+[final_procs[-1].mtype_short()], memPrintsDir, sector, split) - # A bodge for TrackBuilder to write TF concatenated track+stub data. - # (Needed to compare with emData/). - if 'TW_104' in memInfoDict.keys(): - fileTF = open("bodge/TF_tb_constants.vhd.bodge") - string_constants += fileTF.read(); - + if 'TW_113' in memInfoDict.keys(): + string_constants += 'constant FILE_OUT_TF : string := dataOutDir&"TF_";'; + string_ctrl_signals = writeTBControlSignals(memDict, memInfoDict, initial_proc, final_procs, notfinal_procs,split, MPARdict) string_begin = writeTBEntityBegin()