-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_bitstream.sh
More file actions
111 lines (100 loc) · 2.82 KB
/
Copy pathbuild_bitstream.sh
File metadata and controls
111 lines (100 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# Check if exactly two arguments are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <memory_type> <platform>"
exit 1
fi
# Validate first argument
mem_type=$1
if [[ ! "$mem_type" =~ ^(uram|host-dram|on-board-dram)$ ]]; then
echo "Error: Memory type must be one of 'uram', 'host-dram', or 'on-board-dram'."
exit 1
fi
# Validate second argument
platform=$2
if [[ ! "$platform" =~ ^(AU280|xupvvh)$ ]]; then
echo "Error: Platform must be either 'AU280' or 'xupvvh'."
exit 1
fi
# check for vivado
if ! command -v vivado &> /dev/null; then
echo "Command 'vivado' is missing, please add it to your PATH"
exit 1
fi
# clone BSV tools if necessary
mkdir -p build
if [ -z "${BSV_TOOLS}" ]; then
if ! [ -d build/BSVTools ]; then
git clone https://github.com/esa-tu-darmstadt/BSVTools.git build/BSVTools
fi
export BSV_TOOLS=$PWD/build/BSVTools
fi
# clone TaPaSCo if variables are not set
tapasco_dir="$(pwd)/build/tapasco"
if [ -z "$(ls build/tapasco)" ]; then
git clone https://github.com/esa-tu-darmstadt/tapasco.git build/tapasco
fi
# create workspace
work_dir="$(pwd)/build/workspace-${mem_type}"
if [ -z "$(ls ${mem_type})" ]; then
mkdir -p ${work_dir}
fi
pushd . && cd ${work_dir} && ${tapasco_dir}/tapasco-init.sh && source tapasco-setup.sh && popd
tapasco-build-toolflow
# build Bluespec cores
echo "Building Bluespec cores..."
pushd . && cd hw/NVMeReaderWriter/ && make SIM_TYPE=VERILOG ip && popd
# write job file
job_file_path=build/nvme-${platform}-${mem_type}-job.json
cat << EOF > "${job_file_path}"
[{
"Job": "Compose",
"Design Frequency": 300,
"SkipSynthesis": false,
"DeleteProjects": false,
"Platforms": [
"${platform}"
],
"Architectures": [
"axi4mm"
],
"Composition": {
"Composition": [
{
"Kernel": "NVMeReaderWriter",
"Count": 1
}
]
},
"Features": [
{
"Feature": "NVME",
"Properties": {
"enabled": "true",
"axis_read_command": "M_NVME_READ_REQ",
"axis_write_command": "M_NVME_WRITE_REQ",
"axis_read_response": "S_NVME_READ_RSP",
"axis_write_response": "S_NVME_WRITE_RSP",
"memory": "${mem_type}"
}
},
{
"Feature": "CustomConstraints",
"Properties": {
"path": "$(pwd)/constraints/pblock-mem-${platform}.xdc"
}
}
]
}]
EOF
# build TaPaSCo bitstream
echo "Generating device image"
tapasco import hw/NVMeReaderWriter/build/ip/NVMeReaderWriter.zip as 4875 -p ${platform}
tapasco --jobsFile ${job_file_path}
bitstream_file_path=$TAPASCO_WORK_DIR/compose/axi4mm/${platform}/NVMeReaderWriter/001/300.0+CustomConstraints+NVME/axi4mm-${platform}--NVMeReaderWriter_1--300.bit
if [ -f "${bitstream_file_path}" ]; then
echo "Device image created successfully"
echo "Bitstream file: ${bitstream_file_path}"
else
echo "ERROR: Failed to create device image"
fi