Download chisel/src/nand/Primitives.scala from Snapkitty/phaser-ags: direct link, hf CLI and curl.
- Browser
- Download file 2.32 kB
-
https://huggingface.co/Snapkitty/phaser-ags/resolve/main/chisel/src/nand/Primitives.scala
- Command line
-
hf download hf://Snapkitty/phaser-ags/chisel/src/nand/Primitives.scala
-
curl -L -o Primitives.scala https://huggingface.co/Snapkitty/phaser-ags/resolve/main/chisel/src/nand/Primitives.scala
2.32 kB
| // SPDX-License-Identifier: AGPL-3.0-or-later | |
| // Copyright 2025 Ahmad Ali Parr / SnapKitty β https://github.com/SNAPKITTYWEST/phaser-ags | |
| package nand | |
| import chisel3._ | |
| import chisel3.util._ | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // NAND2 β Primitive gate, maps 1:1 to the CMOS SPICE circuit | |
| // | |
| // SPICE: 2 PMOS parallel (pull-up) + 2 NMOS series (pull-down) | |
| // Chisel: built-in operator, synthesizer maps to standard cell | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| class Nand2 extends Module { | |
| val io = IO(new Bundle { | |
| val a = Input(Bool()) | |
| val b = Input(Bool()) | |
| val y = Output(Bool()) | |
| }) | |
| io.y := ~(io.a & io.b) | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // NAND3 β 3 PMOS parallel + 3 NMOS series | |
| // Matches nand3_jacobian.sp tridiagonal Jacobian | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| class Nand3 extends Module { | |
| val io = IO(new Bundle { | |
| val a = Input(Bool()) | |
| val b = Input(Bool()) | |
| val c = Input(Bool()) | |
| val y = Output(Bool()) | |
| }) | |
| io.y := ~(io.a & io.b & io.c) | |
| } | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| // NOR2 β Complementary to NAND: 2 PMOS series + 2 NMOS parallel | |
| // βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| class Nor2 extends Module { | |
| val io = IO(new Bundle { | |
| val a = Input(Bool()) | |
| val b = Input(Bool()) | |
| val y = Output(Bool()) | |
| }) | |
| io.y := ~(io.a | io.b) | |
| } | |