コード例 #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.
    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)
コード例 #2
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)
コード例 #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.
    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,
        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)