aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md26
-rwxr-xr-xclean.sh6
-rw-r--r--flake.lock11
-rw-r--r--flake.nix28
-rw-r--r--fpga/Makefile (renamed from Makefile)7
-rw-r--r--fpga/default.nix35
-rw-r--r--fpga/src/App.bs (renamed from src/App.bs)0
-rw-r--r--fpga/src/Top.bs (renamed from src/Top.bs)0
-rw-r--r--fpga/src/TopSim.bs (renamed from src/TopSim.bs)0
-rw-r--r--fpga/src/Uart.bs (renamed from src/Uart.bs)0
-rw-r--r--fpga/src/Util.bs (renamed from src/Util.bs)0
-rw-r--r--fpga/src/icebreaker.pcf (renamed from src/icebreaker.pcf)0
12 files changed, 90 insertions, 23 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9bb3c4d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,26 @@
+# numini
+
+A small CPU and a computer built around it.
+
+## Overview
+
+Currently, the planned hardware is based around an [iCEBreaker] and an [Inkplate 6].
+The [original Inkplate 6 case]'s top is used (since the Inkplate came glued to it), but the bottom is replaced by a 3D-printed custom case that leaves room for the remainder of the components and ports on the bottom.
+The Inkplate provides power via a lithium battery, and access to its display, its microSD card, and its Wi-Fi and Bluetooth connectivity.
+The iCEBreaker is connected to the Inkplate over both I²C and UART.
+The iCEBreaker is augmented with a [quad HyperRAM PMOD] module, which it uses for main memory.
+
+[iCEBreaker]: https://docs.icebreaker-fpga.org/
+[Inkplate 6]: https://soldered.com/product/soldered-inkplate-6-6-e-paper-board/
+[original Inkplate 6 case]: https://github.com/SolderedElectronics/Inkplate-6-hardware/blob/master/3D%20printable%20case/Original%20case
+[quad HyperRAM PMOD]: https://1bitsquared.com/products/pmod-hyperram
+
+The different components are in the following subdirectories:
+
+- `case/` contains the [OpenSCAD] code for the case design.
+- `fpga/` contains the [Bluespec] code that runs on the iCEBreaker.
+- `inkplate/` contains the code that runs on the Inkplate.
+- `simhost/` contains Rust code that implements simulated peripherals for bluesim.
+
+[Bluespec]: https://github.com/B-Lang-org/bsc
+[OpenSCAD]: https://openscad.org/
diff --git a/clean.sh b/clean.sh
new file mode 100755
index 0000000..d37cd91
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -euxo pipefail
+git status --porcelain=v1 --ignored -z \
+| grep -z '^!!' \
+| xargs -0 awk 'BEGIN { for(i = 1; i < ARGC; i++) printf "%s%c", substr(ARGV[i], 4), 0; }' \
+| xargs -0 rm -r
diff --git a/flake.lock b/flake.lock
index 2ea934c..812b43e 100644
--- a/flake.lock
+++ b/flake.lock
@@ -19,17 +19,16 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1714933973,
- "narHash": "sha256-a3cOXb2Hhj/z6N+oCfJJTdpWUx0V8rTqmY96i8N9B0A=",
+ "lastModified": 1721949857,
+ "narHash": "sha256-DID446r8KsmJhbCzx4el8d9SnPiE8qa6+eEQOJ40vR0=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "135fbd12c398100f8071584d2b8c9c7aa2bc5e99",
+ "rev": "a1cc729dcbc31d9b0d11d86dc7436163548a9665",
"type": "github"
},
"original": {
- "owner": "NixOS",
- "repo": "nixpkgs",
- "type": "github"
+ "id": "nixpkgs",
+ "type": "indirect"
}
},
"root": {
diff --git a/flake.nix b/flake.nix
index bc12844..7877aa2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,22 +1,28 @@
{
- inputs.nixpkgs.url = "github:NixOS/nixpkgs";
- outputs = { self, flake-utils, nixpkgs }:
- flake-utils.lib.eachDefaultSystem (system:
- let pkgs = nixpkgs.legacyPackages.${system};
- in rec {
+ outputs =
+ {
+ self,
+ flake-utils,
+ nixpkgs,
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ rec {
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues packages;
nativeBuildInputs = [
- pkgs.bluespec
pkgs.gtkwave
- pkgs.icestorm
- pkgs.nextpnr
pkgs.picocom
- pkgs.yosys
];
env.BSC = pkgs.bluespec;
};
- packages = { };
- });
+ packages = {
+ fpga = pkgs.callPackage ./fpga { };
+ };
+ }
+ );
}
diff --git a/Makefile b/fpga/Makefile
index d2a6e87..c9326a7 100644
--- a/Makefile
+++ b/fpga/Makefile
@@ -6,16 +6,11 @@ TOPMODULE = mkTop
SRCS = $(shell find src -name '*.bs')
all: tmp/$(TOPMODULE).bin
-clean:
- @git status --porcelain=v1 --ignored -z \
- | grep -z '^!!' \
- | xargs -0 awk 'BEGIN { for(i = 1; i < ARGC; i++) printf "%s%c", substr(ARGV[i], 4), 0; }' \
- | xargs -0 rm -r
flash: tmp/$(TOPMODULE).bin
sudo iceprog $<
gtkwave: tmp/sim.vcd
gtkwave -A $<
-.PHONY: all clean flash gtkwave
+.PHONY: all flash gtkwave
tmp/sim.vcd: tmp/$(TOPMODULE)Sim.exe
tmp/$(TOPMODULE)Sim.exe -V $@
diff --git a/fpga/default.nix b/fpga/default.nix
new file mode 100644
index 0000000..ad4d4b4
--- /dev/null
+++ b/fpga/default.nix
@@ -0,0 +1,35 @@
+{
+ bluespec,
+ icestorm,
+ nextpnr,
+ yosys,
+ stdenv,
+}:
+
+stdenv.mkDerivation {
+ pname = "numini-fpga";
+ version = "0.1.0";
+ src = ./.;
+ nativeBuildInputs = [
+ bluespec
+ icestorm
+ nextpnr
+ yosys
+ ];
+ configurePhase = ''
+ runHook preConfigure
+ export BSC=${bluespec}
+ runHook postConfigure
+ '';
+ buildFlags = [
+ "tmp/mkTop.bin"
+ "tmp/mkTopSim.exe"
+ ];
+ installPhase = ''
+ runHook preInstall
+ install -DTm600 tmp/mkTop.bin $out/numini.bin
+ install -DTm700 tmp/mkTopSim.exe $out/numini-bluesim
+ install -DTm700 tmp/mkTopSim.exe.so $out/numini-bluesim.so
+ runHook postInstall
+ '';
+}
diff --git a/src/App.bs b/fpga/src/App.bs
index cbe6454..cbe6454 100644
--- a/src/App.bs
+++ b/fpga/src/App.bs
diff --git a/src/Top.bs b/fpga/src/Top.bs
index 9afaaab..9afaaab 100644
--- a/src/Top.bs
+++ b/fpga/src/Top.bs
diff --git a/src/TopSim.bs b/fpga/src/TopSim.bs
index d0d17cb..d0d17cb 100644
--- a/src/TopSim.bs
+++ b/fpga/src/TopSim.bs
diff --git a/src/Uart.bs b/fpga/src/Uart.bs
index 1059a65..1059a65 100644
--- a/src/Uart.bs
+++ b/fpga/src/Uart.bs
diff --git a/src/Util.bs b/fpga/src/Util.bs
index ab3074c..ab3074c 100644
--- a/src/Util.bs
+++ b/fpga/src/Util.bs
diff --git a/src/icebreaker.pcf b/fpga/src/icebreaker.pcf
index 1164c98..1164c98 100644
--- a/src/icebreaker.pcf
+++ b/fpga/src/icebreaker.pcf