Skip to content

Commit 63b41f2

Browse files
committed
xrt sandbox simulation
1 parent cc7fdf2 commit 63b41f2

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

hw/syn/xilinx/sandbox/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ kernel.bin.coe: $(KERNEL).bin
5353
pre_opt_hook.tcl: $(SRC_DIR)/pre_opt_hook.tcl
5454
cp $< $@
5555

56+
simulate.tcl: $(SRC_DIR)/simulate.tcl
57+
cp $< $@
58+
5659
gen-sources: project_1/sources.txt
5760
project_1/sources.txt:
5861
mkdir -p project_1
@@ -63,7 +66,10 @@ done.dcp: project_1/sources.txt kernel.bin.coe project.tcl pre_opt_hook.tcl
6366
MAX_JOBS=$(JOBS) TOOL_DIR=$(SCRIPT_DIR) $(VIVADO) -mode batch -source project.tcl -tclargs $(DEVICE) project_1/sources.txt
6467
echo done > done.dcp
6568

66-
run: project_1/project_1.xpr
69+
run: simulate.tcl done.dcp
70+
MAX_JOBS=$(JOBS) TOOL_DIR=$(SCRIPT_DIR) $(VIVADO) -mode batch -source simulate.tcl -tclargs project_1/project_1.xpr 50000ns
71+
72+
open: done.dcp
6773
$(VIVADO) project_1/project_1.xpr &
6874

6975
clean:

hw/syn/xilinx/sandbox/simulate.tcl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright © 2019-2023
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
if { $::argc != 2 } {
15+
puts "ERROR: Program \"$::argv0\" requires 2 arguments!\n"
16+
puts "Usage: $::argv0 <project> <simtime>\n"
17+
exit
18+
}
19+
20+
set project_file [lindex $::argv 0]
21+
set sim_time [lindex $::argv 1]
22+
23+
set tb_name testbench ;# Replace with actual testbench module
24+
25+
open_project $project_file ;# Ensure correct project is loaded
26+
27+
# Ensure testbench is set as simulation top
28+
set_property top $tb_name [get_filesets sim_1]
29+
30+
# Launch the simulation
31+
launch_simulation -mode behavioral
32+
33+
# Run for the specified number of cycles
34+
run $sim_time

0 commit comments

Comments
 (0)