Close

Operations: 0..9, A..F (entering digits)

A project log for Bit-serial CPU based on crossbar switch

256 switches and few shift registers to implement a working 16 or 32-bit integer arithmetic calculator (+, -, *, /, isqrt, BCD / bin conv..)

zpekiczpekic 04/27/2022 at 04:340 Comments

Like in most calculators, digits are entered the TOS (top of stack) register from right, pushing all other digits up for 4 bits, with MSN (most significant nibble) lost.

There are many ways to accomplish this, but the approach here is a bit complicated because the optimization was done to minimize microcode needed:

...
        .map 'a';
        .map 'A';
        .map 'e';
        .map 'E';
        data 0b1101, goto hexchar;    // correction from reverse ASCII is 11
...
 hexchar:    load_bitcnt 3, c_flag <= zero, nuke, matrix_nop1();
        connect row_const to col_adc1;
        connect row_direct to col_adc2;
        connect row_sum to col_tos;
        STATUS = busy_using_mt, opr = m2_d2_d2, bitcnt <= dec, if bitcnt_is_zero then next else repeat;
        disconnect row_sum from col_tos, bitcnt <= max;
        connect row_tos to col_tos, bitcnt <= dec;
        bitcnt <= dec;
        bitcnt <= dec;
        bitcnt <= dec;
        STATUS = busy_using_mt, opr = np_d2_d2, bitcnt <= dec, if bitcnt_is_zero then nextchar else repeat;

 State before shifts:

State after the shifts (digit A was entered, switch is position 0, 0 could be stayed off):

Discussions