Compare commits

..

No commits in common. "0d2719c39f8bde7ea5018abdf84c54452437ab76" and "20b16b6d40cb81343dce4130d7c08f63a22f686f" have entirely different histories.

7 changed files with 30 additions and 97 deletions

View file

@ -1,22 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1723637854, "lastModified": 1723637854,
@ -35,24 +18,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -5,9 +5,17 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
}; };
outputs = inputs@{ nixpkgs, flake-utils, ... }: outputs = inputs@{ nixpkgs, ... }:
let let
python-overlay = import ./python.nix; # litex-overlay = final: prev: {
# pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
# (python-final: python-prev: {
# litex = python-final.callPackage (import ./litex.nix) { };
# # can add more packages here!
# })
# ];
# };
litex-overlay = import ./litex;
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
forAllSystems = function: forAllSystems = function:
nixpkgs.lib.genAttrs systems (system: function ( nixpkgs.lib.genAttrs systems (system: function (
@ -15,31 +23,38 @@
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ overlays = [
python-overlay ]; # patches, version pins, new pkgs here.
];
} }
)); ));
in { in {
packages = forAllSystems (pkgs: { packages = forAllSystems (pkgs: {
sim = import ./sim/package.nix pkgs; sim = import ./sim/package.nix pkgs;
}); });
devShells = forAllSystems (pkgs: { devShells = forAllSystems (pkgs: {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
(python3.withPackages (ps: with ps; [ (python3.withPackages (ps: with ps; [
cocotb
amaranth amaranth
])) ]))
yosys yosys
nextpnr nextpnr
pkgsCross.riscv64.buildPackages.gcc
gnumake
wishbone-tool
# simulators # simulators
iverilog verilog
verilator verilator
# support package # support package
trellis trellis
# loader # loader
openfpgaloader openfpgaloader
ecpdap # easier to poke probes. ecpdap # easier to poke probes.
# for building the simulator
cmake
ninja
mdbook
]; ];
}; };
}); });

View file

@ -5,7 +5,7 @@
groups = ["default", "dev"] groups = ["default", "dev"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:fbfe1db54d73aa2641413610d5e62d87b02de247293e2af3cd53ee0c283318db" content_hash = "sha256:00a75da930aaa4d4233631525c1b6bb3c9642e99065be33cf83e74d4ad611d08"
[[metadata.targets]] [[metadata.targets]]
requires_python = "==3.12.*" requires_python = "==3.12.*"
@ -29,14 +29,11 @@ files = [
[[package]] [[package]]
name = "amaranth-boards" name = "amaranth-boards"
version = "0.1.dev250" version = "0"
requires_python = "~=3.8" summary = "Placeholder package name reserved for Amaranth HDL"
git = "https://github.com/amaranth-lang/amaranth-boards.git"
revision = "19b97324ecf9111c5d16377af79f82aad761c476"
summary = "Board and connector definitions for Amaranth HDL"
groups = ["default"] groups = ["default"]
dependencies = [ files = [
"amaranth<0.7,>=0.4", {file = "amaranth_boards-0-py3-none-any.whl", hash = "sha256:0cc6af682122197b532eef7c2d378a59905ac5e63ec5c69b9147b1e05bf2c600"},
] ]
[[package]] [[package]]

View file

@ -7,7 +7,7 @@ authors = [
] ]
dependencies = [ dependencies = [
"amaranth>=0.5.1", "amaranth>=0.5.1",
"amaranth-boards @ git+https://github.com/amaranth-lang/amaranth-boards.git", "amaranth-boards>=0",
] ]
requires-python = "==3.12.*" requires-python = "==3.12.*"
readme = "README.md" readme = "README.md"

View file

@ -1,18 +0,0 @@
# overlay python patched version with amaranth/boards updated.
final: prev: {
python3 = prev.python3.override {
packageOverrides = pyfinal: pyprev: {
amaranth = pyprev.amaranth.overridePythonAttrs {
version = "0.6.0.dev53";
src = prev.pkgs.fetchFromGitHub {
owner = "amaranth-lang";
repo = "amaranth";
rev = "e30d822a7d93ee615e70e95a9958051dcc794802";
hash = "sha256-A46CMWGvqUFTp3geFFccUM9M7iECmNndzWm2GxA8XbE";
};
doCheck = false;
# installCheckPhase = "${prev.python3.interpreter} -m unittest discover -t . -s tests -v";
};
};
};
}

View file

@ -2,7 +2,7 @@ import os
import subprocess import subprocess
from amaranth.vendor import LatticeECP5Platform from amaranth.vendor import LatticeECP5Platform
from amaranth.build import Resource, Pins, Attrs, Clock, Subsignal, PinsN, Connector from amaranth.build import Resource, Pins, Attrs, Clock, Subsignal, PinsN, Connector
from amaranth_boards.resources import SDRAMResource, LEDResources, ButtonResources from amaranth_boards.resources import SDRAMResource
class Colorlight_5A75B_R82Platform(LatticeECP5Platform): class Colorlight_5A75B_R82Platform(LatticeECP5Platform):
@ -23,10 +23,8 @@ class Colorlight_5A75B_R82Platform(LatticeECP5Platform):
Subsignal("copi", Pins("T8", dir="o")), Subsignal("copi", Pins("T8", dir="o")),
Attrs(IO_TYPE="LVCMOS33"), Attrs(IO_TYPE="LVCMOS33"),
), ),
*LEDResources(pins="T6", invert=True, attrs=Attrs(IO_TYPE="LVCMOS33", DRIVE="4")), Resource("usr_btn", 0, Pins("R7", dir="i"), Attrs(IO_TYPE="LVCMOS33")),
*ButtonResources( Resource("usr_led", 0, Pins("T6", dir="o"), Attrs(IO_TYPE="LVCMOS33")),
pins="R7", invert=True, attrs=Attrs(IO_TYPE="LVCMOS33", PULLMODE="UP")
),
SDRAMResource( SDRAMResource(
0, 0,
clk="C8", clk="C8",

View file

@ -1,26 +0,0 @@
from amaranth import Elaboratable, Module, Signal
from amaranth.lib.io import Buffer
from groovylight.platforms.colorlight_5a75b_v8_2 import Colorlight_5A75B_R82Platform
class Blinky(Elaboratable):
def elaborate(self, platform):
m = Module()
m.submodules.led = led = Buffer("o", platform.request("led", dir="-"))
state = Signal()
counter = Signal(24)
with m.If(counter == 0):
m.d.sync += [counter.eq(~0), state.eq(~state)]
with m.Else():
m.d.sync += counter.eq(counter - 1)
m.d.comb += led.o.eq(state)
return m
def test_platform():
plat = Colorlight_5A75B_R82Platform()
plat.build(Blinky())