File: diamond.py

package info (click to toggle)
prjtrellis 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 83,000 kB
  • sloc: cpp: 20,813; python: 16,246; sh: 375; makefile: 262; asm: 80; ansic: 58
file content (23 lines) | stat: -rw-r--r-- 578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
Python wrapper for `diamond.sh`
"""
from os import path
import os
import subprocess
import database


def run(device, source, no_trce=False, mapargs=None, backanno=False):
    """
    Run diamond.sh with a given device name and source Verilog file
    """
    env = os.environ.copy()
    if no_trce:
        env["NO_TRCE"] = "1"
    if backanno:
        env["BACKANNO"] = "1"
    if mapargs is not None:
        env["MAPARGS"] = mapargs
    dsh_path = path.join(database.get_trellis_root(), "diamond.sh")
    return subprocess.run(["bash",dsh_path,device,source], env=env)