Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(description="LiteEth standalone core generator")
    builder_args(parser)
    parser.set_defaults(output_dir="build")
    parser.add_argument("config", help="YAML config file")
    args = parser.parse_args()
    core_config = yaml.load(open(args.config).read(), Loader=yaml.Loader)

    # Convert YAML elements to Python/LiteX --------------------------------------------------------
    for k, v in core_config.items():
        replaces = {"False": False, "True": True, "None": None}
        for r in replaces.keys():
            if v == r:
                core_config[k] = replaces[r]
        if k == "phy":
            core_config[k] = getattr(liteeth_phys, core_config[k])
        if k in ["clk_freq", "phy_tx_delay", "phy_rx_delay"]:
            core_config[k] = int(float(core_config[k]))

    # Generate core --------------------------------------------------------------------------------
    if  "device" not in core_config:
        core_config["device"] = ""
    if core_config["vendor"] == "lattice":
        platform = LatticePlatform(core_config["device"], io=[], toolchain="diamond")
    elif core_config["vendor"] == "xilinx":
        platform = XilinxPlatform(core_config["device"], io=[], toolchain="vivado")
    else:
        raise ValueError("Unsupported vendor: {}".format(core_config["vendor"]))
    platform.add_extension(_io)

    if core_config["core"] == "wishbone":
        soc = MACCore(platform, core_config)
    elif core_config["core"] == "udp":
        soc = UDPCore(platform, core_config)
    else:
        raise ValueError("Unknown core: {}".format(core_config["core"]))

    builder_arguments = builder_argdict(args)
    builder_arguments["compile_gateware"] = False
    if builder_arguments["csr_csv"] is None:
        builder_arguments["csr_csv"] = os.path.join(builder_arguments["output_dir"], "csr.csv")

    builder = Builder(soc, **builder_arguments)
    builder.build(build_name="liteeth_core")
Exemplo n.º 2
0
 def __init__(self):
     XilinxPlatform.__init__(self, "", _io)
Exemplo n.º 3
0
 def __init__(self):
     XilinxPlatform.__init__(self, "xc7", _io)