Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first FPGA with merged TPARs #60

Merged
merged 22 commits into from
Sep 10, 2024
Merged

first FPGA with merged TPARs #60

merged 22 commits into from
Sep 10, 2024

Conversation

jasonfan393
Copy link
Contributor

PR linked with firmware_hls (338). contains changes to the interface of the first FPGA project in a split configuration.

Draft for now to work out merge conflicts in firmware_hls and cleanup.

@jasonfan393 jasonfan393 changed the title Tf mergestream first FPGA with merged TPARs Apr 19, 2024
@jasonfan393
Copy link
Contributor Author

Working on adding split tag everywhere to preserve non dual-fpga chains

@jasonfan393 jasonfan393 marked this pull request as ready for review May 21, 2024 17:30
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
WriteVHDLSyntax.py Outdated Show resolved Hide resolved
Comment on lines +477 to +479
if (interface != -1 and not extraports) or (split == 1 and "TPAR" in mem):
if "TPAR" in mem:
wirelist += " signal "+mem+"_dummy : std_logic_vector(1 downto 0);\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

@jasonfan393 Would it be possible to remove this signal by setting the corresponding address ports to open?

Suggested change
if (interface != -1 and not extraports) or (split == 1 and "TPAR" in mem):
if "TPAR" in mem:
wirelist += " signal "+mem+"_dummy : std_logic_vector(1 downto 0);\n"
if (interface != -1 and not extraports):

Comment on lines +636 to +656
addrwidth = 10
ramwidth = memInfo.bitwidth
numpages = 8
seed = mem.split("_")[1][:-1]
iTC = mem.split("_")[1][-1]
for PCGroup in MPARdict[seed]:
if iTC == PCGroup[0]:
numInputs = len(PCGroup)
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 2,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => MPAR_"+seed+PCGroup+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_AV_dout_nent,\n"
for i in range(numInputs): merge_portlist += " addr_arr("+str(((i+1)*addrwidth)-1)+" downto "+ str(i*addrwidth)+ ")=>TPAR_"+seed+PCGroup[i%numInputs]+"_V_readaddr,\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

@jasonfan393 Would it be possible to eliminate the hard-coded value of addrwidth, e.g., by concatenating the inputs to addr_arr?:

Suggested change
addrwidth = 10
ramwidth = memInfo.bitwidth
numpages = 8
seed = mem.split("_")[1][:-1]
iTC = mem.split("_")[1][-1]
for PCGroup in MPARdict[seed]:
if iTC == PCGroup[0]:
numInputs = len(PCGroup)
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 2,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => MPAR_"+seed+PCGroup+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_AV_dout_nent,\n"
for i in range(numInputs): merge_portlist += " addr_arr("+str(((i+1)*addrwidth)-1)+" downto "+ str(i*addrwidth)+ ")=>TPAR_"+seed+PCGroup[i%numInputs]+"_V_readaddr,\n"
ramwidth = memInfo.bitwidth
numpages = 8
seed = mem.split("_")[1][:-1]
iTC = mem.split("_")[1][-1]
for PCGroup in MPARdict[seed]:
if iTC == PCGroup[0]:
numInputs = len(PCGroup)
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 2,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => MPAR_"+seed+PCGroup+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>TPAR_"+seed+PCGroup[i%numInputs]+"_AV_dout_nent,\n"
merge_portlist += " addr_arr=>(TPAR_"+seed+PCGroup[-1]+"_V_readaddr"
for i in reversed(range(numInputs-1)): merge_portlist += ", TPAR_"+seed+PCGroup[i]+"_V_readaddr"
merge_portlist += "),\n"

Comment on lines +662 to +678
addrwidth = 10
ramwidth = memInfo.bitwidth
numpages = 8
numInputs = 1
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 0,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => "+mem+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>" +mem+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>" +mem+"_AV_dout_nent,\n"
for i in range(numInputs): merge_portlist += " addr_arr("+str(((i+1)*addrwidth)-1)+" downto "+ str(i*addrwidth)+ ")=>"+mem+"_V_readaddr,\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

@jasonfan393 Do we even need to specify the range of the addr_arr port here, since there is only one input?:

Suggested change
addrwidth = 10
ramwidth = memInfo.bitwidth
numpages = 8
numInputs = 1
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 0,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => "+mem+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>" +mem+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>" +mem+"_AV_dout_nent,\n"
for i in range(numInputs): merge_portlist += " addr_arr("+str(((i+1)*addrwidth)-1)+" downto "+ str(i*addrwidth)+ ")=>"+mem+"_V_readaddr,\n"
ramwidth = memInfo.bitwidth
numpages = 8
numInputs = 1
merge_parameterlist += " RAM_WIDTH => "+str(ramwidth)+",\n"
merge_parameterlist += " NUM_PAGES => "+str(numpages)+",\n"
merge_parameterlist += " NUM_INPUTS => "+str(numInputs)+",\n"
merge_parameterlist += " NUM_EXTRA_BITS => 0,\n"
merge_portlist += " bx_in => TP_bx_out,\n"
merge_portlist += " rst => '0',\n"
merge_portlist += " clk => clk,\n"
merge_portlist += " enb_arr => open,\n"
merge_portlist += " bx_out => open,\n"
merge_portlist += " merged_dout => "+mem+"_stream_V_dout,\n"
for i in range(4): merge_portlist += " din"+str(i)+"=>" +mem+"_V_dout,\n"
for i in range(4): merge_portlist += " nent"+str(i)+"=>" +mem+"_AV_dout_nent,\n"
for i in range(numInputs): merge_portlist += " addr_arr=>"+mem+"_V_readaddr,\n"

Comment on lines +1648 to +1651
string_mem_ports += " "+argname+"_dataarray_data_V_address0(9 downto 0) => "
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_writeaddr,\n"
string_mem_ports += " "+argname+"_dataarray_data_V_address0(11 downto 10) => "
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_dummy,\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

@jasonfan393 Could we remove the hard-coded bit widths by, e.g., concatenating the inputs to the address port?:

Suggested change
string_mem_ports += " "+argname+"_dataarray_data_V_address0(9 downto 0) => "
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_writeaddr,\n"
string_mem_ports += " "+argname+"_dataarray_data_V_address0(11 downto 10) => "
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_dummy,\n"
string_mem_ports += " "+argname+"_dataarray_data_V_address0 => ("
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_dummy, "
string_mem_ports += mem.mtype_short() + "_" + mem.var()+"_writeaddr),\n"

@jasonfan393
Copy link
Contributor Author

@aehart remaining comments are related to a band-aid fix that I made because of a change for FPGA2 in the TPAR address size from 10 -> 12 to support FPGA2. I believe vivado sim does not support concatenation at the port map, which I agree would make these hacks a lot simpler. I think ultimately we need to make some change to the TPAR HLS memory so that it is not expecting a 12 bit address on FPGA1.

I think I have some idea on how to fix this, but should we just merge this and I can fix the underlying issue with a later patch?

@aehart
Copy link
Contributor

aehart commented Sep 10, 2024

I believe vivado sim does not support concatenation at the port map, which I agree would make these hacks a lot simpler.

I do see lines like this in the generated SectorProcessor:

      outerVMStubs_binmask8_0_V_0     => (VMSTE_L2PHIAn1_AV_dout_mask(0)(56), VMSTE_L2PHIAn1_AV_dout_mask(0)(48), VMSTE_L2PHIAn1_AV_dout_mask(0)(40), VMSTE_L2PHIAn1_AV_dout_mask(0)(32), VMSTE_L2PHIAn1_AV_dout_mask(0)(24), VMSTE_L2PHIAn1_AV_dout_mask(0)(16), VMSTE_L2PHIAn1_AV_dout_mask(0)(8), VMSTE_L2PHIAn1_AV_dout_mask(0)(0)),

This is taken from the port map for TP_L1L2A. So whether or not the simulation supports it, we do seem to be using concatenation in the port map.

@aryd
Copy link
Contributor

aryd commented Sep 10, 2024 via email

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.

Looks good, modulo some hacks that will be addressed separately. Approved!

@aehart aehart merged commit 68630ed into master Sep 10, 2024
1 check passed
@aehart aehart deleted the tf_mergestream branch September 10, 2024 14:01
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