pub enum Error {
Io(Error),
Fmt(Error),
ParseInt(ParseIntError),
FreeCategory(FreeCategoryError),
WidthMismatch {
expected: Width,
actual: Width,
},
TypeMismatch {
expected: TypeName,
actual: TypeName,
},
ClockDomainMismatch,
UndefinedSignal {
name: SignalName,
},
ImmatureSim {
cycle: Cycle,
},
Overflow {
width: Width,
},
UnsupportedInCircom(&'static str),
CircomWidthOverflow {
width: Width,
field_bits: Width,
},
}Expand description
The workspace-wide error enum.
Every fallible operation in hdl-cat-* returns Result<T, Error>.
Variants either wrap an underlying error type or encode a
domain-specific failure.
§Examples
use hdl_cat_error::{Error, Width};
let e = Error::WidthMismatch {
expected: Width::new(8),
actual: Width::new(4),
};
assert_eq!(
e.to_string(),
"width mismatch: expected 8 bit(s), got 4 bit(s)",
);Variants§
Io(Error)
Underlying I/O failure.
Fmt(Error)
Underlying core::fmt failure (e.g. from a writer).
ParseInt(ParseIntError)
Underlying integer parse failure.
FreeCategory(FreeCategoryError)
A free-category IR construction error from comp-cat-rs.
WidthMismatch
A value did not fit its declared hardware width.
Fields
TypeMismatch
A hardware value’s runtime type does not match the expected type.
Fields
ClockDomainMismatch
Two signals from different clock domains were composed.
UndefinedSignal
A signal referenced in an IR or codegen pass was never defined.
Fields
name: SignalNameThe name that could not be resolved.
ImmatureSim
A simulation attempted to read a register before the first clock edge had advanced state beyond its initial value.
Overflow
A value overflowed its declared range during arithmetic.
UnsupportedInCircom(&'static str)
An IR op has no Circom lowering in the current backend version.
The payload is a short static identifier (e.g. "add",
"reg") naming the op and the reason the Circom emitter
refused it. Combinational bitwise ops, Const, Slice, and
Concat are supported in v1; arithmetic and stateful ops are
scheduled for a follow-up.
CircomWidthOverflow
A Circom signal’s declared bit width exceeds the target field’s maximum safe width.
Circom’s scalar fields are prime of ~254 or ~64 bits depending
on the target curve. An intermediate whose worst-case witness
would exceed that width cannot be emitted without lowering
through a Num2Bits gadget.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()