Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        description="Gateware simulation framework")
    parser.add_argument("-c",
                        "--ci",
                        default=False,
                        action="store_true",
                        help="Run with settings for automated CI")

    args = parser.parse_args()

    generate_top()

    # copy the ADC simulation values to the right place
    design_txt = open("run/design.txt", "w")
    global adc_values
    design_txt.write(adc_values)
    init_time = 161000
    print("generating random data for avalanche generator...")
    for i in range(65536):
        design_txt.write(
            "{} {} 0.0 2.5 0.0 {} 0.0 0.5 0.0 0.0 0.0 41 0.95 1.80 0.95\n".
            format(str(init_time),
                   (0.5 * random.randrange(4096) / 4096) + 0.25,
                   (0.25 * random.randrange(4096) / 4096) + 0.5))
        init_time += 1000
    design_txt.close()
    print("done.")

    run_sim(ci=args.ci)
    if args.ci:
        if CheckSim() != 0:
            sys.exit(1)

    sys.exit(0)
Exemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser(description="Gateware simulation framework")
    parser.add_argument(
        "-c", "--ci", default=False, action="store_true", help="Run with settings for automated CI"
    )

    args = parser.parse_args()

    generate_top()
    run_sim(ci=args.ci)
    if args.ci:
        if CheckSim() != 0:
            sys.exit(1)

    sys.exit(0)
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(
        description="Gateware simulation framework")
    parser.add_argument("-c",
                        "--ci",
                        default=False,
                        action="store_true",
                        help="Run with settings for automated CI")

    args = parser.parse_args()

    generate_top()

    # generate a .init file for the SPINOR memory based on the BIOS we want to boot
    os.system(
        "rm -f run/simspi.init"
    )  # the "w" argument is not replacing the file for some reason, it's appending. delete it.
    with open("run/software/bios/bios.bin", "rb") as ifile:
        with open("run/simspi.init", "w") as ofile:
            binfile = ifile.read()

            count = 0
            for b in binfile:
                ofile.write("{:02x}\n".format(b))
                count += 1

            while count < 64 * 1024:
                ofile.write("00\n")
                count += 1

            ofile.write("C3\n")
            ofile.write("69\n")
            ofile.write("DE\n")
            ofile.write("C0\n")

    run_sim(ci=args.ci)
    if args.ci:
        if CheckSim() != 0:
            sys.exit(1)

    sys.exit(0)