mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-04 06:43:07 +00:00
Remove filtering in membus
This commit is contained in:
parent
91e8d52d35
commit
0b78c43fa3
@ -49,11 +49,11 @@ pub fn eval_packed<P: PackedField>(
|
|||||||
lv: &CpuColumnsView<P>,
|
lv: &CpuColumnsView<P>,
|
||||||
yield_constr: &mut ConstraintConsumer<P>,
|
yield_constr: &mut ConstraintConsumer<P>,
|
||||||
) {
|
) {
|
||||||
let is_cpu_cycle: P = COL_MAP.op.iter().map(|&col_i| lv[col_i]).sum();
|
// Validate `lv.code_context`.
|
||||||
// Validate `lv.code_context`. It should be 0 if in kernel mode and `lv.context` if in user
|
// It should be 0 if in kernel mode and `lv.context` if in user mode.
|
||||||
// mode.
|
// Note: This doesn't need to be filtered to CPU cycles, as this should also be satisfied
|
||||||
yield_constr
|
// during Kernel bootstrapping.
|
||||||
.constraint(is_cpu_cycle * (lv.code_context - (P::ONES - lv.is_kernel_mode) * lv.context));
|
yield_constr.constraint(lv.code_context - (P::ONES - lv.is_kernel_mode) * lv.context);
|
||||||
|
|
||||||
// Validate `channel.used`. It should be binary.
|
// Validate `channel.used`. It should be binary.
|
||||||
for channel in lv.mem_channels {
|
for channel in lv.mem_channels {
|
||||||
@ -66,13 +66,13 @@ pub fn eval_ext_circuit<F: RichField + Extendable<D>, const D: usize>(
|
|||||||
lv: &CpuColumnsView<ExtensionTarget<D>>,
|
lv: &CpuColumnsView<ExtensionTarget<D>>,
|
||||||
yield_constr: &mut RecursiveConstraintConsumer<F, D>,
|
yield_constr: &mut RecursiveConstraintConsumer<F, D>,
|
||||||
) {
|
) {
|
||||||
// Validate `lv.code_context`. It should be 0 if in kernel mode and `lv.context` if in user
|
// Validate `lv.code_context`.
|
||||||
// mode.
|
// It should be 0 if in kernel mode and `lv.context` if in user mode.
|
||||||
|
// Note: This doesn't need to be filtered to CPU cycles, as this should also be satisfied
|
||||||
|
// during Kernel bootstrapping.
|
||||||
let diff = builder.sub_extension(lv.context, lv.code_context);
|
let diff = builder.sub_extension(lv.context, lv.code_context);
|
||||||
let constr = builder.mul_sub_extension(lv.is_kernel_mode, lv.context, diff);
|
let constr = builder.mul_sub_extension(lv.is_kernel_mode, lv.context, diff);
|
||||||
let is_cpu_cycle = builder.add_many_extension(COL_MAP.op.iter().map(|&col_i| lv[col_i]));
|
yield_constr.constraint(builder, constr);
|
||||||
let filtered_constr = builder.mul_extension(is_cpu_cycle, constr);
|
|
||||||
yield_constr.constraint(builder, filtered_constr);
|
|
||||||
|
|
||||||
// Validate `channel.used`. It should be binary.
|
// Validate `channel.used`. It should be binary.
|
||||||
for channel in lv.mem_channels {
|
for channel in lv.mem_channels {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user