Compare commits
No commits in common. "1150113101999dc5e019180cab18c852f3482486" and "899877d47fef9c6df18f65b008ee81a5ae6f2e5d" have entirely different histories.
1150113101
...
899877d47f
@ -2,10 +2,6 @@ import typer
|
|||||||
import elab as elaborate
|
import elab as elaborate
|
||||||
import build_env
|
import build_env
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
|
|
||||||
gantry_install_path = "/home/thesis2/exjobb-public/scripts"
|
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
|
||||||
@ -46,29 +42,7 @@ def run(
|
|||||||
print(f"Running (and synthesizing if needed) {topdef} with arch {arch} in library {library}. VHDL {std}")
|
print(f"Running (and synthesizing if needed) {topdef} with arch {arch} in library {library}. VHDL {std}")
|
||||||
return elaborate.runDesign(topdef, arch, library, std)
|
return elaborate.runDesign(topdef, arch, library, std)
|
||||||
|
|
||||||
@hardware.command(help="Synthesizes the provided top level design using NXPython. Make sure you run this with NXPython.")
|
@hardware.command()
|
||||||
def synth(
|
|
||||||
topdef: Annotated[str, typer.Argument(help="Top Definition entity to synthesize")] = "",
|
|
||||||
library: Annotated[str, typer.Option("--library", "-l", help="Library to compile from, defaults to \"work\"")] = "work"
|
|
||||||
):
|
|
||||||
proc = subprocess.run(["source_and_run.sh", f"{gantry_install_path}/nxp_script.py", "synthDesign", library, topdef])
|
|
||||||
|
|
||||||
@hardware.command(help="Places the provided top level design using NXPython. Make sure you run this with NXPython.")
|
|
||||||
def place(
|
|
||||||
topdef: Annotated[str, typer.Argument(help="Top Definition entity to synthesize")] = "",
|
|
||||||
library: Annotated[str, typer.Option("--library", "-l", help="Library to compile from, defaults to \"work\"")] = "work"
|
|
||||||
):
|
|
||||||
proc = subprocess.run(["source_and_run.sh", f"{gantry_install_path}/nxp_script.py", "placeDesign", library, topdef])
|
|
||||||
|
|
||||||
|
|
||||||
@hardware.command(help="Routes the provided top level design using NXPython. Make sure you run this with NXPython.")
|
|
||||||
def route(
|
|
||||||
topdef: Annotated[str, typer.Argument(help="Top Definition entity to synthesize")] = "",
|
|
||||||
library: Annotated[str, typer.Option("--library", "-l", help="Library to compile from, defaults to \"work\"")] = "work"
|
|
||||||
):
|
|
||||||
proc = subprocess.run(["source_and_run.sh", f"{gantry_install_path}/nxp_script.py", "routeDesign", library, topdef])
|
|
||||||
|
|
||||||
@hardware.command(help="")
|
|
||||||
def build():
|
def build():
|
||||||
print("Build!")
|
print("Build!")
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PWD=$(pwd)
|
PWD=$(pwd)
|
||||||
ESCAPED_PWD=$(printf '%s\n' "$PWD" | sed -e 's/[\/&]/\\&/g')
|
|
||||||
echo $ESCAPED_PWD
|
|
||||||
sed -i "0,/gantry_install_path =\"\"/s/gantry_install_path = \"\"/gantry_install_path = \"$ESCAPED_PWD\"/" gantry.py
|
|
||||||
printf "#!/bin/bash \n$PWD/bin/python3 $PWD/gantry.py \$@" > "$PWD/gantry"
|
printf "#!/bin/bash \n$PWD/bin/python3 $PWD/gantry.py \$@" > "$PWD/gantry"
|
||||||
chmod +x "$PWD/gantry"
|
chmod +x "$PWD/gantry"
|
||||||
|
|
||||||
|
|||||||
@ -1,81 +0,0 @@
|
|||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import build_env
|
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
from nxpython import *
|
|
||||||
|
|
||||||
artifact_path = ""
|
|
||||||
|
|
||||||
# Evaluate whether we want the user to provide a selection of files
|
|
||||||
def makeProject(library: str, project_name: str, path):
|
|
||||||
# Create an Impulse project and add all VHDL files to it
|
|
||||||
print(path)
|
|
||||||
#Createproject enters the implicitly created directory
|
|
||||||
print(f"Creating project \'{project_name}\'\n")
|
|
||||||
getProject().setTopCellName(library, project_name)
|
|
||||||
getProject().setVariantName("NG-MEDIUM", "LGA-625")
|
|
||||||
getProject().addParameters({})
|
|
||||||
print(path)
|
|
||||||
listed = list(os.listdir(path))
|
|
||||||
files = list(filter(lambda x: ".vhdl" in x or ".vhd" in x or ".v\0" in x, listed)) # Find VHDL and Verilog files
|
|
||||||
files = list(map(lambda x: os.path.join(path, x), files))
|
|
||||||
print(f"Adding the following files to project: {files}\n")
|
|
||||||
getProject().addFiles(files)
|
|
||||||
print("Saving project")
|
|
||||||
getProject().save(os.path.join(artifact_path, project_name + ".nym"))
|
|
||||||
return 0
|
|
||||||
|
|
||||||
# Do we want the user to specify how far they want to progress wach step? What does the number mean?
|
|
||||||
def synthDesign(library: str, project_name: str, path):
|
|
||||||
# Synthesize the design of the project of the provided `project_name`
|
|
||||||
print("Starting synthesis\n")
|
|
||||||
try:
|
|
||||||
nymFile = os.path.join(artifact_path, project_name + ".nym")
|
|
||||||
os.lstat(nymFile)
|
|
||||||
getProject().loadNative(nymFile)
|
|
||||||
except:
|
|
||||||
print("No existing project found, creating new project\n")
|
|
||||||
makeProject(library, project_name, path)
|
|
||||||
getProject().loadNative(os.path.join(artifact_path, project_name + ".nym"))
|
|
||||||
getProject().progress("Synthesize", 3)
|
|
||||||
getProject().save(os.path.join(artifact_path, project_name + "-synth.nym"))
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def placeDesign(library: str, project_name: str, path):
|
|
||||||
# Place the given design. Will use a previously synthesized project if available, otherwise one will be created.
|
|
||||||
print("Starting place\n")
|
|
||||||
try:
|
|
||||||
nymFile = os.path.join(artifact_path, project_name + "-synth.nym")
|
|
||||||
os.lstat(nymFile)
|
|
||||||
getProject().load(nymFile)
|
|
||||||
except:
|
|
||||||
print("No existing synthesis found, entering synthesis stage\n")
|
|
||||||
synthDesign(library, project_name, path)
|
|
||||||
getProject().load(os.path.join(artifact_path, project_name + "-synth.nym"))
|
|
||||||
getProject().progress("Place", 5)
|
|
||||||
getProject().save(os.path.join(artifact_path, project_name + "-place.nym"))
|
|
||||||
|
|
||||||
def routeDesign(library: str, project_name: str, path):
|
|
||||||
# Route the given design. Will use a previously placed project if available, otherwise one will be created.
|
|
||||||
print("Starting route\n")
|
|
||||||
try:
|
|
||||||
nymFile = os.path.join(artifact_path, project_name + "-place.nym")
|
|
||||||
os.lstat(nymFile)
|
|
||||||
getProject().load(nymFile)
|
|
||||||
except:
|
|
||||||
print("No existing place found, entering place stage\n")
|
|
||||||
placeDesign(library, project_name, path)
|
|
||||||
getProject().load(os.path.join(artifact_path, project_name + "-place.nym"))
|
|
||||||
getProject().progress("Route", 3)
|
|
||||||
getProject().save(os.path.join(artifact_path, project_name + "-route.nym"))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
path = os.getcwd()
|
|
||||||
artifact_path = os.path.join(path, "syn")
|
|
||||||
print(f"Calling {sys.argv[1]}() with arguments {sys.argv[2]}, {sys.argv[3]}")
|
|
||||||
createProject(artifact_path)
|
|
||||||
globals()[sys.argv[1]](sys.argv[2], sys.argv[3], path)
|
|
||||||
getProject().createAnalyzer()
|
|
||||||
getProject().getAnalyzer().launch(conditions="worstcase", maximumSlack=0, searchPathsLimit=10, synthesisMode=False)
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source /gsl/cad/modules/init/bash
|
|
||||||
|
|
||||||
module add /gsl/cad/modules/modulefiles/nanoxplore/nxdesignsuite/24.3.0.0
|
|
||||||
nxpython $@
|
|
||||||
Loading…
x
Reference in New Issue
Block a user