Skip to content

Commit b4a52b9

Browse files
committed
Adding vivado template
1 parent 87f5b47 commit b4a52b9

2 files changed

Lines changed: 43 additions & 3 deletions

File tree

examples/baremetal/make.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Simple script that loops over benchmarks using
33
# a native yosys script running at the command line
44
#####################################################################
5+
# TODO: use read_slang instead of read_verilog (vlist)
6+
#
57
import argparse
68
import subprocess
79
import os
@@ -14,10 +16,12 @@
1416
parser = argparse.ArgumentParser(description="""\
1517
1618
LogikBench bare metal usage example
17-
-Calls tools using single file scripts
19+
-Runs using single file jinja script template
1820
-No dependency on external run time infrastructures
21+
1922
Example Usage:
20-
make.py -tool yosys -group epfl
23+
python make.py -tool yosys -target ice40 -group epfl -name mem_ctrl
24+
2125
""", formatter_class=argparse.RawDescriptionHelpFormatter)
2226

2327
parser.add_argument("-group",
@@ -32,7 +36,6 @@
3236
required=True,
3337
help="Benchmark tool")
3438
parser.add_argument("-target",
35-
choices=['ice40'],
3639
required=True,
3740
help="Benchmark target")
3841

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# === USER CONFIGURATION ===
2+
set proj_name "{{ name }}"
3+
set proj_dir "./vivado_project"
4+
set top_module "{{ top }}"
5+
set part "{{ target }}"
6+
set filelist "{{ filename }}"
7+
8+
# === PROJECT SETUP ===
9+
create_project $proj_name $proj_dir -part $part -force
10+
11+
# Read .f file and add RTL + includes
12+
set fp [open $filelist r]
13+
while {[gets $fp line] >= 0} {
14+
set line [string trim $line]
15+
if {[string match "#*" $line] || $line eq ""} {
16+
continue ;# Skip comments and empty lines
17+
} elseif {[string match "-I*" $line]} {
18+
set incdir [string range $line 2 end]
19+
set_property include_dirs [concat $incdir] [current_fileset]
20+
} elseif {[file exists $line]} {
21+
add_files $line
22+
} else {
23+
puts "Warning: Skipping unknown or missing entry: $line"
24+
}
25+
}
26+
close $fp
27+
28+
# Set top module
29+
set_property top $top_module [current_fileset]
30+
31+
# === SYNTHESIS ===
32+
launch_runs synth_1
33+
wait_on_run synth_1
34+
35+
# === REPORTING ===
36+
report_utilization -file "$proj_dir/post_synth_util.rpt"
37+
report_timing_summary -file "$proj_dir/post_synth_timing.rpt"

0 commit comments

Comments
 (0)