jvm.chisel.internal
JVM interop boundary for jvm.chisel.
This is the only namespace that talks to Chisel/Scala. It centralises the three awkward parts of calling Chisel from Clojure:
-
Chisel’s public operators are Scala macros that expand to
do_<mangled>methods taking an explicitchisel3.experimental.SourceInfo. We pass a singleUnlocatableSourceInfoeverywhere and reach thedo_*methods throughclojure.lang.Reflector(the receiver type varies per Data subtype, so a single reflective dispatch is the clean option). -
Companion-object factories (
UInt,Wire,Mux, …) and package-object helpers (fromIntToWidth,fromIntToLiteral, …) are fixed targets and are type-hinted. -
Module bodies must run inside the module constructor, which Clojure cannot inject into. A tiny Java base (
xt.chisel.DynModule) runs a callback in its constructor;modulebinds*module*around it so thatiocan register itself for port naming.
Reflection warnings are disabled for this namespace only: this is the one sanctioned reflective boundary.
bundle
(bundle elts)Bundle from an ordered map/seq of name Data pairs. Field access uses field; keyword lookup is intentionally not provided (a Chisel Record cannot also be a Clojure ILookup).
cat
(cat a)(cat a b)(cat a b & more)concatenate (a ## b ## …) lsb-first by pairwise do_##
emit-system-verilog
(emit-system-verilog builder)(emit-system-verilog builder chisel-args firtool-opts)module
(module name body-fn)Return a zero-arg builder thunk for a module named name. body-fn is a no-arg fn that constructs io/wiring. The module is only elaborated once the thunk is invoked inside ChiselStage (i.e. by emit-* or module-instance), because a module can only be built within a Chisel Builder context.
module-instance
(module-instance build-thunk)Instantiate a module, i.e. Module(new Child(…)). build-thunk is the zero-arg builder returned by module.
register-io!
(register-io! m data name)Called by io: name the IO and expose it on the module for port discovery.
vec-as-uint
(vec-as-uint coll)VecInit(coll).asUInt — pack a seq of Bool/Bits into a UInt (lsb first).
vec-init
(vec-init coll)VecInit(coll) — a chisel Vec from a seq of Data (supports dynamic indexing).