Ejemplo n.º 1
0
 def __init__(self, revision=None, toolchain="icestorm"):
     self.revision = revision
     if revision == "evt":
         from litex_boards.platforms.fomu_evt import _io, _connectors
         LatticePlatform.__init__(self,
                                  "ice40-up5k-sg48",
                                  _io,
                                  _connectors,
                                  toolchain="icestorm")
         self.spi_size = 16 * 1024 * 1024
         self.spi_dummy = 6
     elif revision == "dvt":
         from litex_boards.platforms.fomu_pvt import _io, _connectors
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io,
                                  _connectors,
                                  toolchain="icestorm")
         self.spi_size = 2 * 1024 * 1024
         self.spi_dummy = 6
     elif revision == "pvt":
         from litex_boards.platforms.fomu_pvt import _io, _connectors
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io,
                                  _connectors,
                                  toolchain="icestorm")
         self.spi_size = 2 * 1024 * 1024
         self.spi_dummy = 6
     elif revision == "hacker":
         from litex_boards.platforms.fomu_hacker import _io, _connectors
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io,
                                  _connectors,
                                  toolchain="icestorm")
         self.spi_size = 2 * 1024 * 1024
         self.spi_dummy = 4
     elif revision == "jeannie":
         from litex_boards.platforms.gadgetfactory_jeannie import _io, _connectors
         LatticePlatform.__init__(self,
                                  "ice40-up5k-sg48",
                                  _io,
                                  _connectors,
                                  toolchain="icestorm")
         self.spi_size = 16 * 1024 * 1024
         self.spi_dummy = 4
     else:
         raise ValueError(
             "Unrecognized revision: {}.  Known values: evt, dvt, pvt, hacker"
             .format(revision))
Ejemplo n.º 2
0
 def __init__(self, revision="pvt", toolchain="icestorm"):
     self.revision = revision
     if revision == "evt":
         LatticePlatform.__init__(self,
                                  "ice40-up5k-sg48",
                                  _io_evt,
                                  _connectors,
                                  toolchain="icestorm")
     elif revision == "dvt":
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io_dvt,
                                  _connectors,
                                  toolchain="icestorm")
     elif revision == "pvt":
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io_pvt,
                                  _connectors,
                                  toolchain="icestorm")
     elif revision == "hacker":
         LatticePlatform.__init__(self,
                                  "ice40-up5k-uwg30",
                                  _io_hacker,
                                  _connectors,
                                  toolchain="icestorm")
     else:
         raise ValueError(
             "Unrecognized reivsion: {}.  Known values: evt, dvt, pvt, hacker"
             .format(revision))
Ejemplo n.º 3
0
def generate_verilog():
    platform = LatticePlatform("", io=[], toolchain="diamond")
    platform.add_extension(gen._io)

    core_config = {
        "clk_freq": int(125e6),
        "phy": liteeth_phys.LiteEthECP5PHYRGMII,
        "mac_address": 0xAA040000CFCF,
        "ip_address": "192.168.178.50",
        "port": 1710,
    }

    soc = gen.UDPCore(platform, core_config)
    with tempfile.TemporaryDirectory() as tmpdirname:
        builder = Builder(soc, compile_gateware=False, output_dir=tmpdirname)
        builder.build(build_name="liteeth_core")
        return (Path(tmpdirname) / "gateware" / "liteeth_core.v").read_bytes()
Ejemplo n.º 4
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")
Ejemplo n.º 5
0
 def __init__(self, io, toolchain="icestorm", revision="pvt"):
     self.revision = revision
     LatticePlatform.__init__(self, "ice40-up5k-sg48", io, toolchain="icestorm")
 def __init__(self):
     LatticePlatform.__init__(self,
                              "ice40-hx8k-ct256",
                              _io,
                              toolchain="icestorm")