Skip to content

Conversation

@aryd
Copy link
Contributor

@aryd aryd commented Sep 2, 2025

This PR consists of a set of updates to both project_generation_scripts and firmware_hls to solve several disagreements between the reduced FPGA1 project and the CMSSW C++ emulation. Many of the fixes here should be considered "patches" - e.g. the filewriting should be moved into the memory modules to make sure that we accurately print the correct debug information. Now there is a fair bit of manual adjustment to get the debug printout to allign with the memory writing.

project_generation_scripts:

  • To avoid an overwrite of the InputLink memories I changed them to use 4 pages instead of two. Could probably have used two page after adding delays in the memory writing. This is particularly a problem here as we read multiple input memories in the VMR and the last memory to be read was over written in one of the 100 events.

  • Add delay in the FileWriterFIFO modules to align debug writing with correct BX. Similarly align debug printout for VMSTE, IL, and AS

firmware_hls:

  • Add delay in the FileWriterFIFO.vhd

  • tf_merge_streamer.vhd has some significant rewrites to process data on each BX. The logic is a bit convoluted as the bx_in_vld signal is not aligned with the change in bx. A delay of three clocks has been added to fix this. This should probably be fixed in a cleaner way.

  • Fixes to CompareMemPrintsFW.py to handle MPAR and AS memories. This could be avoided if the debug printout followed the memory writing.

  • Make the IL memory use 4 pages instead of 2.

Comment on lines +274 to +293
#horrible hack to fix order of modules
ia=-1;
ib=-1;
for mem in memList:
if "_BE" in mem.var() :
ia=memList.index(mem);
if "_BF" in mem.var() :
ib=memList.index(mem);
if ia != -1 and ib != -1 and ib < ia :
memList[ia], memList[ib] = memList[ib], memList[ia]

ia=-1;
ib=-1;
for mem in memList:
if "L1PHIH_BC" in mem.var() :
ia=memList.index(mem);
if "L1PHIH_BD" in mem.var() :
ib=memList.index(mem);
if ia != -1 and ib != -1 and ib < ia :
memList[ia], memList[ib] = memList[ib], memList[ia]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aryd I'm assuming the order here comes from the order in the wiring files, so should the order ultimately be fixed in the TrackletConfigBuilder in CMSSW? I'm not proposing doing this immediately, but it seems like it would be better to eventually fix the issue where it originates, if possible.

Copy link
Contributor

@aehart aehart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from my one question, which is just out of curiosity, this looks good, so I will approve and merge.

@aehart aehart merged commit 9a1943a into master Sep 9, 2025
1 check passed
@aehart aehart deleted the FPGA1_Debug_rebase branch September 9, 2025 11:11
@aryd
Copy link
Contributor Author

aryd commented Sep 9, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants