Skip to content

Commit

Permalink
Move maxWidth.txt handling to FABulous.py (FPGA-Research-Manchester…
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoBi22 authored Sep 6, 2023
1 parent b6b0e88 commit 4385da4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 10 additions & 1 deletion FABulous.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,21 @@ def do_gen_model_vpr(self, args):
with open(f"{self.projectDir}/{metaDataDir}/architecture.xml", "w") as f:
f.write(vprModel)

vprRoutingResource = self.fabricGen.genModelVPRRoutingResource()
routingResourceInfo = self.fabricGen.genModelVPRRoutingResource()
# Write the routing resource graph
vprRoutingResource = routingResourceInfo[0]
logger.info(
f"Output file: {self.projectDir}/{metaDataDir}/routing_resource.xml")
with open(f"{self.projectDir}/{metaDataDir}/routing_resource.xml", "w") as f:
f.write(vprRoutingResource)

# Write maxWidth.txt
vprMaxWidth = routingResourceInfo[1]
logger.info(
f"Output file: {self.projectDir}/{metaDataDir}/maxWidth.txt")
with open(f"{self.projectDir}/{metaDataDir}/maxWidth.txt", "w") as f:
f.write(str(vprMaxWidth))

vprConstrain = self.fabricGen.genModelVPRConstrains()
logger.info(
f"Output file: {self.projectDir}/{metaDataDir}/fab_constraints.xml")
Expand Down
8 changes: 2 additions & 6 deletions fabric_generator/model_generation_vpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def genVPRModel(fabric: Fabric, customXMLfile: str = "") -> str:
return ET.tostring(root, encoding="unicode")


def genVPRRoutingResourceGraph(fabric: Fabric) -> str:
def genVPRRoutingResourceGraph(fabric: Fabric) -> (str, int):
root = ET.Element("rr_graph")
root.attrib = {"tool_name": "vpr",
"tool_version": "82a3c72",
Expand Down Expand Up @@ -640,11 +640,7 @@ def genVPRRoutingResourceGraph(fabric: Fabric) -> str:

ET.indent(root, space=" ")

with open(".FABulous/maxWidth.txt", "w") as f:
logger.info("Output file: ./.FABulous/maxWidth.txt")
f.write(f"{maxWidth}")

return ET.tostring(root, encoding="unicode")
return ET.tostring(root, encoding="unicode"), maxWidth


def genVPRConstrainsXML(fabric: Fabric) -> str:
Expand Down

0 comments on commit 4385da4

Please sign in to comment.