|
1 | 1 | import os
|
| 2 | +import argparse |
2 | 3 | import subprocess
|
3 | 4 |
|
4 | 5 | from amaranth.build import *
|
5 | 6 | from amaranth.vendor import LatticeMachXO3LPlatform
|
6 | 7 | from .resources import *
|
7 | 8 |
|
8 | 9 |
|
9 |
| -__all__ = ["MachXO3SKPlatform"] |
| 10 | +__all__ = ["MachXO3LSKPlatform", "MachXO3LFSKPlatform"] |
10 | 11 |
|
11 | 12 |
|
12 |
| -class MachXO3SKPlatform(LatticeMachXO3LPlatform): |
13 |
| - device = "LCMXO3LF-6900C" |
| 13 | +class _MachXO3SKPlatform(LatticeMachXO3LPlatform): |
14 | 14 | package = "BG256"
|
15 | 15 | speed = "5"
|
16 | 16 | default_clk = "clk12"
|
@@ -69,6 +69,27 @@ def toolchain_program(self, products, name):
|
69 | 69 | subprocess.check_call([openFPGALoader, bitstream_filename])
|
70 | 70 |
|
71 | 71 |
|
| 72 | +class MachXO3LSKPlatform(_MachXO3SKPlatform): |
| 73 | + device = "LCMXO3L-6900C" |
| 74 | + |
| 75 | + |
| 76 | +class MachXO3LFSKPlatform(_MachXO3SKPlatform): |
| 77 | + device = "LCMXO3LF-6900C" |
| 78 | + |
| 79 | + |
72 | 80 | if __name__ == "__main__":
|
73 | 81 | from .test.blinky import *
|
74 |
| - MachXO3SKPlatform().build(Blinky(), do_program=True) |
| 82 | + |
| 83 | + variants = { |
| 84 | + 'MachXO3L': MachXO3LSKPlatform, |
| 85 | + 'MachXO3LF': MachXO3LFSKPlatform, |
| 86 | + } |
| 87 | + |
| 88 | + # Figure out which FPGA variant we want to target... |
| 89 | + parser = argparse.ArgumentParser() |
| 90 | + parser.add_argument('variant', choices=variants.keys()) |
| 91 | + parser.add_argument('toolchain', nargs="?", choices=["Trellis", "Diamond"], default="Trellis") |
| 92 | + args = parser.parse_args() |
| 93 | + |
| 94 | + platform = variants[args.variant] |
| 95 | + platform(toolchain=args.toolchain).build(Blinky(), do_program=True) |
0 commit comments