2022-11-28 13:19:40 -08:00
|
|
|
pub(crate) mod eq_iszero;
|
2022-06-14 16:55:08 -07:00
|
|
|
mod not;
|
|
|
|
|
|
2022-06-27 07:18:21 -07:00
|
|
|
use plonky2::field::extension::Extendable;
|
2022-06-27 15:07:52 -07:00
|
|
|
use plonky2::field::packed::PackedField;
|
2022-06-14 16:55:08 -07:00
|
|
|
use plonky2::hash::hash_types::RichField;
|
|
|
|
|
use plonky2::iop::ext_target::ExtensionTarget;
|
|
|
|
|
|
|
|
|
|
use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer};
|
2022-06-29 16:23:44 -07:00
|
|
|
use crate::cpu::columns::CpuColumnsView;
|
2022-06-14 16:55:08 -07:00
|
|
|
|
|
|
|
|
pub fn eval_packed<P: PackedField>(
|
2022-06-29 16:23:44 -07:00
|
|
|
lv: &CpuColumnsView<P>,
|
2023-08-28 16:32:04 -04:00
|
|
|
nv: &CpuColumnsView<P>,
|
2022-06-14 16:55:08 -07:00
|
|
|
yield_constr: &mut ConstraintConsumer<P>,
|
|
|
|
|
) {
|
2023-10-26 17:52:54 -04:00
|
|
|
not::eval_packed(lv, nv, yield_constr);
|
2023-08-28 16:32:04 -04:00
|
|
|
eq_iszero::eval_packed(lv, nv, yield_constr);
|
2022-06-14 16:55:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn eval_ext_circuit<F: RichField + Extendable<D>, const D: usize>(
|
|
|
|
|
builder: &mut plonky2::plonk::circuit_builder::CircuitBuilder<F, D>,
|
2022-06-29 16:23:44 -07:00
|
|
|
lv: &CpuColumnsView<ExtensionTarget<D>>,
|
2023-08-28 16:32:04 -04:00
|
|
|
nv: &CpuColumnsView<ExtensionTarget<D>>,
|
2022-06-14 16:55:08 -07:00
|
|
|
yield_constr: &mut RecursiveConstraintConsumer<F, D>,
|
|
|
|
|
) {
|
2023-10-26 17:52:54 -04:00
|
|
|
not::eval_ext_circuit(builder, lv, nv, yield_constr);
|
2023-08-28 16:32:04 -04:00
|
|
|
eq_iszero::eval_ext_circuit(builder, lv, nv, yield_constr);
|
2022-06-14 16:55:08 -07:00
|
|
|
}
|