Пример #1
0
def generate_top():
    global dutio
    global boot_from_spi

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    os.system("mkdir -p ../../target")  # this doesn't exist on the first run
    builder = Builder(soc, output_dir="./run", csr_svd="../../target/soc.svd", compile_gateware=False, compile_software=False)
    vns = builder.build(run=False)
    soc.do_exit(vns)

    BiosHelper(soc, boot_from_spi, nightly=True) # marshals cargo to generate the BIOS from Rust files

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc, output_dir="./run")
    builder.software_packages = [  # Point to a dummy Makefile, so Litex pulls in bios.bin but doesn't try building over it
        ("bios", os.path.abspath(os.path.join(os.path.dirname(__file__), "testbench")))
    ]
    vns = builder.build(run=False)
    soc.do_exit(vns)
Пример #2
0
def generate_top():
    global dutio
    global boot_from_spi

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.
    Preamble()

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc,
                      output_dir="./run",
                      csr_svd="../../target/soc.svd",
                      compile_gateware=False,
                      compile_software=False)
    builder.software_packages = []
    vns = builder.build(run=False)
    soc.do_exit(vns)

    BiosHelper(
        soc,
        boot_from_spi)  # marshals cargo to generate the BIOS from Rust files

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc, output_dir="./run", compile_software=False)
    builder.software_packages = []
    vns = builder.build(run=False)
    soc.do_exit(vns)
Пример #3
0
def generate_top():
    global dutio
    global boot_from_spi

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    os.system("mkdir -p ../../target")  # this doesn't exist on the first run
    builder = Builder(soc,
                      output_dir="./run",
                      csr_svd="../../target/soc.svd",
                      compile_gateware=False,
                      compile_software=False)
    vns = builder.build(run=False)
    soc.do_exit(vns)

    BiosHelper(soc, boot_from_spi)

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform)

    builder = Builder(soc, output_dir="./run")
    os.environ["DUTNAME"] = 'memlcd'
    builder.software_packages = [
        ("bios",
         os.path.abspath(os.path.join(os.path.dirname(__file__), "testbench")))
    ]
    vns = builder.build(run=False)
    soc.do_exit(vns)
Пример #4
0
def generate_top():
    global dutio
    global boot_from_spi

    if os.name == 'nt':
        cpname = 'copy'
        with open('testbench/curve25519-dalek/.cargo/config', 'w') as config:
            config.write('[build]\ntarget="x86_64-pc-windows-msvc"\n')
    else:
        cpname = 'cp'
        with open('testbench/curve25519-dalek/.cargo/config', 'w') as config:
            config.write('[build]\ntarget="x86_64-unknown-linux-gnu"\n')

    Preamble()

    if ~os.path.isfile('testbench/curve25519-dalek/test_vectors.bin'):
        # create a dummy file so that DUT can bootstrap and build soc.svd, required for building test vectors
        with open('testbench/curve25519-dalek/test_vectors.bin', 'wb') as out:
            out.seek(1024)
            out.write(b'\0')

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc,
                      output_dir="./run",
                      csr_svd="../../target/soc.svd",
                      compile_gateware=False,
                      compile_software=False)
    builder.software_packages = []
    vns = builder.build(run=False)
    soc.do_exit(vns)

    BiosHelper(
        soc,
        boot_from_spi)  # marshals cargo to generate the BIOS from Rust files

    # build the test vectors for the curve engine
    ret = os.system(
        "cd testbench/curve25519-dalek && cargo test field::test::make_vectors"
    )
    if ret:
        print("Problem generating test vectors, aborting.")
        sys.exit(1)

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc, output_dir="./run", compile_software=False)
    builder.software_packages = []
    vns = builder.build(run=False)
    soc.do_exit(vns)
Пример #5
0
def generate_top():
    global dutio
    global boot_from_spi

    if ~os.path.isfile('testbench/curve25519-dalek/test_vectors.bin'):
        # create a dummy file so that DUT can bootstrap and build soc.svd, required for building test vectors
        with open('testbench/curve25519-dalek/test_vectors.bin', 'wb') as out:
            out.seek(1024)
            out.write(b'\0')

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    os.system("mkdir -p ../../target")  # this doesn't exist on the first run
    builder = Builder(soc,
                      output_dir="./run",
                      csr_svd="../../target/soc.svd",
                      compile_gateware=False,
                      compile_software=False)
    vns = builder.build(run=False)
    soc.do_exit(vns)

    BiosHelper(
        soc,
        boot_from_spi)  # marshals cargo to generate the BIOS from Rust files

    # build the test vectors for the curve engine
    ret = os.system(
        "cd testbench/curve25519-dalek && cargo test field::test::make_vectors"
    )
    if ret:
        print("Problem generating test vectors, aborting.")
        sys.exit(1)

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc, output_dir="./run")
    builder.software_packages = [  # Point to a dummy Makefile, so Litex pulls in bios.bin but doesn't try building over it
        ("bios",
         os.path.abspath(os.path.join(os.path.dirname(__file__), "testbench")))
    ]
    vns = builder.build(run=False)
    soc.do_exit(vns)
Пример #6
0
def generate_top():
    global dutio
    global boot_from_spi

    # we have to do two passes: once to make the SVD, without compiling the BIOS
    # second, to compile the BIOS, which is then built into the gateware.

    # pass #1 -- make the SVD
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    os.system("mkdir -p ../../target")  # this doesn't exist on the first run
    builder = Builder(soc,
                      output_dir="./run",
                      csr_svd="../../target/soc.svd",
                      compile_gateware=False,
                      compile_software=False)
    vns = builder.build(run=False)
    soc.do_exit(vns)

    os.system(
        "rm -rf testbench/betrusted-pac")  # nuke the old PAC if it exists
    os.system("mkdir -p testbench/betrusted-pac"
              )  # rebuild it from scratch every time
    os.system("cp pac-cargo-template testbench/betrusted-pac/Cargo.toml")
    os.system(
        "cd testbench/betrusted-pac && svd2rust --target riscv -i ../../../../target/soc.svd && rm -rf src; form -i lib.rs -o src/; rm lib.rs"
    )
    BiosHelper(
        soc,
        boot_from_spi)  # marshals cargo to generate the BIOS from Rust files

    # pass #2 -- generate the SoC, incorporating the now-built BIOS
    platform = Platform(dutio)
    soc = Dut(platform, spiboot=boot_from_spi)

    builder = Builder(soc, output_dir="./run")
    builder.software_packages = [  # Point to a dummy Makefile, so Litex pulls in bios.bin but doesn't try building over it
        ("bios",
         os.path.abspath(os.path.join(os.path.dirname(__file__), "testbench")))
    ]
    vns = builder.build(run=False)
    soc.do_exit(vns)