Skip to main content

emit_computedram_reduce_testbench

Function emit_computedram_reduce_testbench 

Source
pub fn emit_computedram_reduce_testbench(
    nwords: usize,
    a: usize,
    b: usize,
    zero: usize,
    a2: usize,
    b2: usize,
    ones: usize,
    aval: u64,
    bval: u64,
) -> String
Expand description

Emit tb_computedram_reduce — proves in-DRAM bitwise AND and OR via triple-row activation. Preloads operands (a=aval, b=bval, zero=0 for AND with a 0 control; a2=aval, b2=bval, ones=~0 for OR with a 1 control), replays the concatenated Maj streams from cdram_reduce.hex, and asserts the majority result: mem[a] == aval & bval (AND = MAJ(a,b,0)) and mem[a2] == aval | bval (OR = MAJ(a,b,1)).