gen/genacorn.c
static void shift_down_step(void)
{
    int extra = -1;
    int s7_l_next = -1;

    // LFSR7: s7_l ^= (f << 4), state->s7 = (f >> 4)
    // We keep the previous s7_l in a register for now and
    // make use of it during shift_down_final().  Allocate
    // a new register to hold the next s7_l value.
    s7_l_prev[lfsr_offset] = s7_l;
    alloc_high_reg(&extra);
    check_high_reg(&f);
    alloc_low_reg(&s7_l_next);
    insn_printf("swap r%d", f);
    insn_printf("mov r%d,r%d", extra, f);
    insn_printf("andi r%d,0xF0", extra);    // Assumes extra is a high reg.
    insn_printf("eor r%d,r%d", s7_l, extra);
    insn_printf("andi r%d,0x0F", f);        // Assumes f is a high reg.
    insn_printf("mov r%d,r%d", s7_l_next, f);
    release_reg(&f);
    release_reg(&extra);
    s7_l = s7_l_next;

    // Write s2 to s6 back to the state.  We don't need to store s1
    // because shift_down_final() will be throwing the value away.
    // The generate_feedback() function already released the register.
    insn_printf("std Z+%d,r%d", get_lfsr(5)->offsetl + lfsr_offset, s6_l);
    release_reg(&s6_l);
    insn_printf("std Z+%d,r%d", get_lfsr(4)->offsetl + lfsr_offset, s5_l);
    release_reg(&s5_l);
    insn_printf("std Z+%d,r%d", get_lfsr(3)->offsetl + lfsr_offset, s4_l);
    release_reg(&s4_l);
    insn_printf("std Z+%d,r%d", get_lfsr(2)->offsetl + lfsr_offset, s3_l);
    release_reg(&s3_l);
    insn_printf("std Z+%d,r%d", get_lfsr(1)->offsetl + lfsr_offset, s2_l);
    release_reg(&s2_l);
}
// Shift the state downwards by 8 bits as one step within a 32-bit word.
Shift the state downwards by 8 bits as one step within a 32-bit word.
Shift the state downwards by 8 bits as one step within a 32 - bit word .
static void shift_down_step(void)
{
    int extra = -1;
    int s7_l_next = -1;
    s7_l_prev[lfsr_offset] = s7_l;
    alloc_high_reg(&extra);
    check_high_reg(&f);
    alloc_low_reg(&s7_l_next);
    insn_printf("swap r%d", f);
    insn_printf("mov r%d,r%d", extra, f);
    insn_printf("andi r%d,0xF0", extra);    
    insn_printf("eor r%d,r%d", s7_l, extra);
    insn_printf("andi r%d,0x0F", f);        
    insn_printf("mov r%d,r%d", s7_l_next, f);
    release_reg(&f);
    release_reg(&extra);
    s7_l = s7_l_next;
    insn_printf("std Z+%d,r%d", get_lfsr(5)->offsetl + lfsr_offset, s6_l);
    release_reg(&s6_l);
    insn_printf("std Z+%d,r%d", get_lfsr(4)->offsetl + lfsr_offset, s5_l);
    release_reg(&s5_l);
    insn_printf("std Z+%d,r%d", get_lfsr(3)->offsetl + lfsr_offset, s4_l);
    release_reg(&s4_l);
    insn_printf("std Z+%d,r%d", get_lfsr(2)->offsetl + lfsr_offset, s3_l);
    release_reg(&s3_l);
    insn_printf("std Z+%d,r%d", get_lfsr(1)->offsetl + lfsr_offset, s2_l);
    release_reg(&s2_l);
}
static void shift_down_step ( void ) { int extra = -1 ; int s7_l_next = -1 ; s7_l_prev [ lfsr_offset ] = s7_l ; alloc_high_reg ( & extra ) ; check_high_reg ( & f ) ; alloc_low_reg ( & s7_l_next ) ; insn_printf ( " " , f ) ; insn_printf ( " " , extra , f ) ; insn_printf ( " " , extra ) ; insn_printf ( " " , s7_l , extra ) ; insn_printf ( " " , f ) ; insn_printf ( " " , s7_l_next , f ) ; release_reg ( & f ) ; release_reg ( & extra ) ; s7_l = s7_l_next ; insn_printf ( " " , get_lfsr ( 5 ) -> offsetl + lfsr_offset , s6_l ) ; release_reg ( & s6_l ) ; insn_printf ( " " , get_lfsr ( 4 ) -> offsetl + lfsr_offset , s5_l ) ; release_reg ( & s5_l ) ; insn_printf ( " " , get_lfsr ( 3 ) -> offsetl + lfsr_offset , s4_l ) ; release_reg ( & s4_l ) ; insn_printf ( " " , get_lfsr ( 2 ) -> offsetl + lfsr_offset , s3_l ) ; release_reg ( & s3_l ) ; insn_printf ( " " , get_lfsr ( 1 ) -> offsetl + lfsr_offset , s2_l ) ; release_reg ( & s2_l ) ; }
Shift the state downwards by 8 bits as one step within a 32-bit word.
Shift the state downwards by 8 bits as one step within a 32 - bit word .
// LFSR7: s7_l ^= (f << 4), state->s7 = (f >> 4) // We keep the previous s7_l in a register for now and // make use of it during shift_down_final().  Allocate // a new register to hold the next s7_l value. // Assumes extra is a high reg. // Assumes f is a high reg. // Write s2 to s6 back to the state.  We don't need to store s1 // because shift_down_final() will be throwing the value away. // The generate_feedback() function already released the register.