Skip to content

Commit d704970

Browse files
mcoshiropwittich
andauthored
EMP FPGA2 (#343)
* rudiments of a dual-fpga EMP project * updates for decl files * move files to proper locations * dummy payload test * update dependencies * Updates for dual-FPGA using latest emp fwk * F1 builds * working build for F2 with trivial payload (CSP test) * update build script * Update emp_project_decl_f2.vhd fix which inter-fpga quads are implemented on F2 * update to tags on emp-fwk and CM_FPGA_FW * emp-fwk to 0.9.0-alpha2 * more updates for 0.9.0-pre2 * tweak build script * Update setup_project.sh * Manually copy EMP changes from emp_dual_* branches * Some fixes to DualFPGA project generation after copy-merging * Some more compatibility changes * Many bug fixes, FPGA2 project now outputs tracks in simulation * Updates to make things work out-of-the-box * First attempt at allowing simultaneous builds for both FPGAs * Some fixes for FPGA1 build and integration * Fixes to control signals on EMP FPGA1 project * Fix make rule for individual FPGA projects * Manually copied FPGA2-targeted changes from dual_fpga2_4_ryd_validupdates * Cleanup based on suggestions from Andrew. Also updated README * Fix issue introduced by attempting to combine vsim.tcl scripts * Remove commented code * Removed left-over PHONY target --------- Co-authored-by: Peter Wittich <[email protected]>
1 parent 2dc0e97 commit d704970

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5571
-182
lines changed

IntegrationTests/CombinedBarrelConfig/IRtoKF/firmware/Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ input_file = mem/in.txt
44
proj_path = ../../../../proj
55
hls_script_path = ../../script
66

7-
all: add_common_files $(core_file) hdl_add_files xciCreation kfin_adj $(input_file) apollo_input lut_inclusion
7+
all: add_common_files $(core_file) hdl_add_files xciCreation kfin_adj $(input_file) apollo_input
88

99
$(core_dir):
1010
@mkdir cgn mem
@@ -32,9 +32,6 @@ add_common_files:
3232
hdl_add_files: $(core_file)
3333
cd hdl; ln -s ../../../hdl/*.vhd .
3434

35-
lut_inclusion:
36-
@python3 scripts/lut_copy.py
37-
3835
$(input_file): $(core_dir)
3936
@python3 scripts/convert_emData2EMP_Link.py -d mem/MemPrintsCMBarrel/InputStubs -o $(input_file)
4037

@@ -53,4 +50,4 @@ sim: $(input_file) $(core_file) $(core_dir)
5350
@cd $(hls_script_path); vivado -mode batch -source runSim.tcl
5451
@python3 scripts/fwtosim_comparison.py -e mem/out.txt -s $(hls_script_path)/dataOut/TF_L1L2.txt
5552

56-
.PHONY: sim all hdl_add_files xciCreation kfin_adj apollo_input lut_inclusion core_patch
53+
.PHONY: sim all hdl_add_files xciCreation kfin_adj apollo_input core_patch
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
set_property SOURCE_SET sources_1 [get_filesets sim_1]
22
add_files -fileset sim_1 -norecurse ../../src/firmware-hls/IntegrationTests/CombinedBarrelConfig/IRtoKF/firmware/mem/in.txt
3-
set lut_script [file dirname [file normalize ../../src/firmware-hls/IntegrationTests/CombinedBarrelConfig/IRtoKF/firmware/scripts/pre_msim.tcl ]]
4-
append lut_script "/pre_msim.tcl"
5-
add_files -fileset utils_1 -norecurse $lut_script
6-
#set_property STEPS.SYNTH_DESIGN.TCL.PRE $lut_script [get_runs sim_1]
7-
#add_files -fileset sim_1 -norecurse ../../src/firmware-hls/firmware/mem/out.txt
8-
set pre_path "set_property -name {xsim.compile.tcl.pre} -value {$lut_script} -objects \[\get_filesets \sim_1\]"
9-
eval ${pre_path}
103

114
# Disabling source management mode. This is to allow the top design properties to be set without GUI intervention.
125
set_property source_mgmt_mode None [current_project]
136
set_property top top [get_filesets sim_1]
147
set_property top_lib xil_defaultlib [get_filesets sim_1]
8+
set_property target_language VHDL [current_project]
9+
set_property simulator_language VHDL [current_project]
1510
# Re-enabling previously disabled source management mode.
1611
set_property source_mgmt_mode All [current_project]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
core_file_fpga1 = scripts/xciMaker_fpga1
2+
core_file_fpga2 = scripts/xciMaker_fpga2
3+
core_dir = cgn
4+
input_file_fpga1 = mem/in_fpga1.txt
5+
input_file_fpga2 = mem/in_fpga2.txt
6+
fpga1_hls_script_path = ../../CombinedConfig_FPGA1/script
7+
fpga2_hls_script_path = ../../CombinedConfig_FPGA2/script
8+
9+
all: add_common_files $(core_file_fpga1) $(core_file_fpga2) hdl_add_files_fpga1 hdl_add_files_fpga2 xciCreation_fpga1 xciCreation_fpga2 kfin_adj $(input_file_fpga1) $(input_file_fpga2) apollo_input_fpga1 apollo_input_fpga2
10+
11+
fpga1: add_common_files $(core_file_fpga1) hdl_add_files_fpga1 xciCreation_fpga1 kfin_adj $(input_file_fpga1) apollo_input_fpga1
12+
13+
fpga2: add_common_files $(core_file_fpga2) hdl_add_files_fpga2 xciCreation_fpga2 kfin_adj $(input_file_fpga2) apollo_input_fpga2
14+
15+
$(core_dir):
16+
@mkdir cgn mem
17+
@mkdir cgn/f1
18+
@mkdir cgn/f2
19+
@cd mem; ln -s ../../../../emData/LUTsSplit LUTs
20+
@cd mem; ln -s ../../../../emData/MemPrintsSplit MemPrintsSplit
21+
@cd hdl; ln -s ../../../common common
22+
23+
$(core_file_fpga1): $(core_dir)
24+
make -C $(fpga1_hls_script_path) -j 24 Work
25+
@python3 scripts/include_cores.py -s $(fpga1_hls_script_path) -o $(core_file_fpga1) -f f1
26+
27+
$(core_file_fpga2): $(core_dir)
28+
make -C $(fpga2_hls_script_path) -j 24 Work
29+
@python3 scripts/include_cores.py -s $(fpga2_hls_script_path) -o $(core_file_fpga2) -f f2
30+
31+
kfin_adj:
32+
@python3 scripts/kf_link_mod.py
33+
34+
xciCreation_fpga1: $(core_file_fpga1)
35+
make -f $(core_file_fpga1) -j 8 all
36+
37+
xciCreation_fpga2: $(core_file_fpga2)
38+
make -f $(core_file_fpga2) -j 8 all
39+
40+
add_common_files:
41+
@if [ ! -d ucf ]; then mkdir ucf; fi
42+
@cd ucf; ln -s ../../../common/ucf/*.tcl .
43+
@cd scripts; ln -s ../../../common/script/emp/* .
44+
45+
hdl_add_files_fpga1: $(core_file)
46+
cd hdl; ln -s ../../../CombinedConfig_FPGA1/hdl/SectorProcessor.vhd SectorProcessor_f1.vhd
47+
cd hdl; ln -s ../../../CombinedConfig_FPGA1/hdl/memUtil_pkg.vhd memUtil_pkg_f1.vhd
48+
49+
hdl_add_files_fpga2: $(core_file)
50+
cd hdl; ln -s ../../../CombinedConfig_FPGA2/hdl/SectorProcessor.vhd SectorProcessor_f2.vhd
51+
cd hdl; ln -s ../../../CombinedConfig_FPGA2/hdl/memUtil_pkg.vhd memUtil_pkg_f2.vhd
52+
53+
$(input_file_fpga1): $(core_dir)
54+
@python3 scripts/convert_emData2EMP_Link.py -d mem/MemPrintsSplit/InputStubs -o $(input_file_fpga1)
55+
56+
$(input_file_fpga2): $(core_dir)
57+
@python3 scripts/convert_emData2EMP_Link_FPGA2.py -d mem/MemPrintsSplit/ -o $(input_file_fpga2)
58+
59+
apollo_input_fpga1: $(input_file_fpga1)
60+
@python3 scripts/split_emp_input.py -i $(input_file_fpga1) -o mem/in_fpga1_
61+
62+
apollo_input_fpga2: $(input_file_fpga2)
63+
@python3 scripts/split_emp_input.py -i $(input_file_fpga2) -o mem/in_fpga2_
64+
65+
.PHONY: all fpga1 fpga2 add_common_files hdl_add_files_fpga1 hdl_add_files_fpga2 xciCreation_fpga1 xciCreation_fpga2 kfin_adj apollo_input_fpga1 apollo_input_fpga2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# common for both FPGAs
2+
3+
4+
src -c emp-fwk:components/datapath emp_data_types.vhd
5+
src -c ipbus-firmware:components/ipbus_core ipbus_fabric_sel.vhd ipbus_package.vhd
6+
7+
include -c ipbus-firmware:components/ipbus_slaves ipbus_syncreg_v.dep ipbus_ctrlreg_v.dep ipbus_reg_v.dep ipbus_freq_ctr.dep
8+
9+
#src ../constrs/floorplan_emp
10+
11+
include -c emp-fwk:components/links/slink slink.dep
12+
13+
addrtab -c emp-fwk:components/payload emp_payload.xml
14+
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
include payload_f1.dep
3+
src emp_project_decl_f1.vhd
4+
setup ../ucf/ip.tcl
5+
6+
include -c emp-fwk:boards/apollo/cm_v2/vu13p cm_v2_p1_2.dep
7+
8+
include apollo.dep
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
include payload_f2.dep
3+
src emp_project_decl_f2.vhd
4+
setup ../ucf/ip.tcl
5+
6+
include -c emp-fwk:boards/apollo/cm_v2/vu13p cm_v2_p2_2.dep
7+
8+
include apollo.dep
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#Payload and top level
2+
src payload_f1.vhd
3+
src tf1_wrapper.vhd
4+
src linktosecproc.vhd
5+
src secproc1tolink.vhd
6+
src --vhdl2008 SectorProcessor_f1.vhd
7+
#src common/hdl/emp/pkgs/tf_interface_pkg.vhd
8+
src memUtil_pkg_f1.vhd
9+
src memUtil_aux_pkg_f1.vhd
10+
src common/hdl/emp/pkgs/GCU_utils.vhd
11+
src conv_pkg_f1.vhd
12+
include -c firmware-hls:KalmanFilter/common components.dep
13+
14+
#Track Builder dependencies
15+
src common/hdl/CreateStartSignal.vhd
16+
#src --vhdl2008 common/hdl/tf_lut.vhd
17+
src --vhdl2008 common/hdl/tf_mem_bin.vhd
18+
src --vhdl2008 common/hdl/tf_mem_format.vhd
19+
src --vhdl2008 common/hdl/tf_mem.vhd
20+
src --vhdl2008 common/hdl/tf_merge_streamer.vhd
21+
src common/hdl/tf_pkg.vhd
22+
src --vhdl2008 common/hdl/tf_pipe_delay.vhd
23+
24+
################
25+
# Include Cores
26+
################
27+
iprepo *
28+
src ../cgn/f1/*/*/*.xci
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
src memUtil_pkg_f2.vhd
2+
src memUtil_aux_pkg_f2.vhd
3+
src payload_f2.vhd
4+
src linktosecproc2.vhd
5+
src sp2_mem_writer.vhd
6+
src tf2_wrapper.vhd
7+
src --vhdl2008 SectorProcessor_f2.vhd
8+
src tf_to_kf.vhd
9+
src kf_wrapper.vhd
10+
src common/hdl/emp/pkgs/tf_interface_pkg.vhd
11+
src kf_input_merger.vhd
12+
13+
# KF
14+
include -c firmware-hls:KalmanFilter/kfin components.dep
15+
include -c firmware-hls:KalmanFilter/kf components.dep
16+
include -c firmware-hls:KalmanFilter/kfout components.dep
17+
include -c firmware-hls:KalmanFilter/tq components.dep
18+
include -c firmware-hls:KalmanFilter/common components.dep
19+
20+
#Tracklet dependencies
21+
src common/hdl/CreateStartSignal.vhd
22+
#src --vhdl2008 common/hdl/tf_lut.vhd
23+
src --vhdl2008 common/hdl/tf_mem_bin.vhd
24+
src --vhdl2008 common/hdl/tf_mem_format.vhd
25+
src --vhdl2008 common/hdl/tf_mem.vhd
26+
src --vhdl2008 common/hdl/tf_mem_tproj.vhd
27+
src --vhdl2008 common/hdl/tf_mem_tpar.vhd
28+
src --vhdl2008 common/hdl/mem_reader.vhd
29+
src common/hdl/tf_pkg.vhd
30+
src --vhdl2008 common/hdl/tf_pipe_delay.vhd
31+
32+
#Floorplan
33+
src ../ucf/floorplan_f2.tcl
34+
35+
################
36+
# Include Cores
37+
################
38+
iprepo *
39+
src ../cgn/f2/*/*/*.xci
40+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#don't include cm_v2_p1_2 since without decoder, it will have unresolved tcds2 dependencies
2+
@fpga_position = "1"
3+
@fpga_speed_grade = "-2-e"
4+
5+
include payload_f1.dep
6+
setup ../ucf/vsim_f1.tcl
7+
8+
include -c emp-fwk:boards/testbench top.dep
9+
10+
src tb_decl_f1.vhd
11+
src emp_project_decl_f1.vhd
12+
src -c emp-fwk:components/links/slink emp_slink_types.vhd
13+
14+
include -c emp-fwk:boards/apollo/cm_v2/vu13p device.dep packages_cm_v2_p1.dep
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#don't include cm_v2_p1_2 since without decoder, it will have unresolved tcds2 dependencies
2+
@fpga_position = "2"
3+
@fpga_speed_grade = "-2-e"
4+
5+
include payload_f2.dep
6+
setup ../ucf/vsim_f2.tcl
7+
8+
include -c emp-fwk:boards/testbench top.dep
9+
10+
src tb_decl_f2.vhd
11+
src emp_project_decl_f2.vhd
12+
src -c emp-fwk:components/links/slink emp_slink_types.vhd
13+
14+
include -c emp-fwk:boards/apollo/cm_v2/vu13p device.dep packages_cm_v2_p2.dep
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
library ieee;
2+
use ieee.std_logic_1164.all;
3+
4+
use work.emp_data_types.all;
5+
use work.hybrid_data_types.all;
6+
7+
package conv_pkg_f1 is
8+
9+
function conv_single (l : ldata)
10+
return t_packet;
11+
12+
end package conv_pkg_f1;
13+
14+
package body conv_pkg_f1 is
15+
16+
function conv_single(l : ldata) return t_packet is
17+
variable s : t_packet;
18+
begin
19+
s.valid := l(68).valid;
20+
s.start_of_orbit := l(68).start_of_orbit;
21+
s.start := l(68).start;
22+
s.last := l(68).last;
23+
return s;
24+
end;
25+
26+
end package body conv_pkg_f1;
27+
28+
29+
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
library IEEE;
3+
use IEEE.STD_LOGIC_1164.all;
4+
5+
use work.emp_framework_decl.all;
6+
use work.emp_device_types.all;
7+
use work.emp_slink_types.all;
8+
9+
package emp_project_decl is
10+
11+
constant PAYLOAD_REV : std_logic_vector(31 downto 0) := X"12345678";
12+
13+
-- Latency buffer size
14+
constant LB_ADDR_WIDTH : integer := 10;
15+
16+
-- Clock setup
17+
constant CLOCK_COMMON_RATIO : integer := 36;
18+
constant CLOCK_RATIO : integer := 6;
19+
constant CLOCK_AUX_DIV : clock_divisor_array_t := (18, 9, 4); -- Dividers of CLOCK_COMMON_RATIO * 40 MHz
20+
21+
-- Readdjust if latency changes for FPGA1 algorithm
22+
constant PAYLOAD_LATENCY : integer := 140;
23+
24+
-- F1 transmits to F2 on inter-fpga links
25+
constant REGION_CONF : region_conf_array_t := (
26+
0 => kDummyRegion, -- service c2c
27+
1 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
28+
2 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
29+
3 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
30+
4 => kDummyRegion, -- not routed
31+
5 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
32+
6 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
33+
7 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
34+
8 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
35+
9 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
36+
10 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
37+
11 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
38+
12 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
39+
13 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
40+
14 => (no_mgt, no_buf, no_fmt, buf, gty25), -- fpga-fpga
41+
15 => kDummyRegion, -- not routed
42+
------cross
43+
----- all MGTs instantiated bidirectionally for now
44+
16 => kDummyRegion, -- not routed
45+
17 => (gty25, buf, no_fmt, buf, gty25), -- firefly
46+
18 => (gty25, buf, no_fmt, buf, gty25), -- firefly
47+
19 => (gty25, buf, no_fmt, buf, gty25), -- firefly
48+
20 => kDummyRegion, -- not routed
49+
21 => (gty25, buf, no_fmt, buf, gty25), -- firefly
50+
22 => (gty25, buf, no_fmt, buf, gty25), -- firefly
51+
23 => (gty25, buf, no_fmt, buf, gty25), -- firefly
52+
24 => (gty25, buf, no_fmt, buf, gty25), -- firefly
53+
25 => (gty25, buf, no_fmt, buf, gty25), -- firefly
54+
26 => (gty25, buf, no_fmt, buf, gty25), -- firefly
55+
27 => (gty25, buf, no_fmt, buf, gty25), -- firefly
56+
28 => (gty25, buf, no_fmt, buf, gty25), -- firefly
57+
29 => (gty25, buf, no_fmt, buf, gty25), -- firefly
58+
30 => (gty25, buf, no_fmt, buf, gty25), -- firefly
59+
31 => kDummyRegion, -- service tcds
60+
61+
others => kDummyRegion
62+
);
63+
64+
-- Specify the slink quad using the corresponding region conf ID
65+
-- Specify slink channels to enable using the channel mask
66+
constant SLINK_CONF : slink_conf_array_t := (
67+
others => kNoSlink
68+
);
69+
70+
71+
end emp_project_decl;

0 commit comments

Comments
 (0)