aboutsummaryrefslogtreecommitdiff
path: root/amaranth_boards/machxo3_sk.py
diff options
context:
space:
mode:
Diffstat (limited to 'amaranth_boards/machxo3_sk.py')
-rw-r--r--amaranth_boards/machxo3_sk.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/amaranth_boards/machxo3_sk.py b/amaranth_boards/machxo3_sk.py
index 0e3dfdd..546d486 100644
--- a/amaranth_boards/machxo3_sk.py
+++ b/amaranth_boards/machxo3_sk.py
@@ -1,4 +1,5 @@
import os
+import argparse
import subprocess
from amaranth.build import *
@@ -6,11 +7,10 @@ from amaranth.vendor import LatticeMachXO3LPlatform
from .resources import *
-__all__ = ["MachXO3SKPlatform"]
+__all__ = ["MachXO3LSKPlatform", "MachXO3LFSKPlatform"]
-class MachXO3SKPlatform(LatticeMachXO3LPlatform):
- device = "LCMXO3LF-6900C"
+class _MachXO3SKPlatform(LatticeMachXO3LPlatform):
package = "BG256"
speed = "5"
default_clk = "clk12"
@@ -69,6 +69,27 @@ class MachXO3SKPlatform(LatticeMachXO3LPlatform):
subprocess.check_call([openFPGALoader, bitstream_filename])
+class MachXO3LSKPlatform(_MachXO3SKPlatform):
+ device = "LCMXO3L-6900C"
+
+
+class MachXO3LFSKPlatform(_MachXO3SKPlatform):
+ device = "LCMXO3LF-6900C"
+
+
if __name__ == "__main__":
from .test.blinky import *
- MachXO3SKPlatform().build(Blinky(), do_program=True)
+
+ variants = {
+ 'MachXO3L': MachXO3LSKPlatform,
+ 'MachXO3LF': MachXO3LFSKPlatform,
+ }
+
+ # Figure out which FPGA variant we want to target...
+ parser = argparse.ArgumentParser()
+ parser.add_argument('variant', choices=variants.keys())
+ parser.add_argument('toolchain', nargs="?", choices=["Trellis", "Diamond"], default="Trellis")
+ args = parser.parse_args()
+
+ platform = variants[args.variant]
+ platform(toolchain=args.toolchain).build(Blinky(), do_program=True)