Datapath saturation flag jump

Example of using datapath saturation flag flag to branch (asserted when the ALU detects a saturation condition). Stage_A input results in several sign changes as output goes from positive to negative and back

Download this project

Program Listing

    // [title] Datapath saturation flag jump
// [brief] Example of using datapath saturation flag flag to branch (asserted when the ALU detects a saturation condition). Stage_A input results in several sign changes as output goes from positive to negative and back
// [categories] Examples - jump conditions

init:
    // [alu]    Enable saturation detection
    acu(clear, clear) dmux(sa, sa) alu(englobals, 100) mac(hold)
    acu(clear, clear) dmux(sa, sa) alu(ensatrnd, 110) mac(hold)
    
    // [dmux]   Set up for bus read to occur in next instruction
    // [mac]    Set up to multiply. Will load a and b terms from bus in next instruction when bus input is read
    acu(hold, hold) addr(1) dmux(bm, bm) alu(hold) mac(clra)

    // [dmux]   Connects shfter to mac, mac to alu to load mac result into alu on both sides
    //          Stage_A[0] is read into data path
    // [mac]    Loads first bus A value into a and b and multiplies them
    acu(hold, hold) dmux(sm, sm) alu(add) mac(hold)

    // Unconditional jump: go to [saturation_check]
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(eob, saturation_check)

saturation_check:
    // Conditional jump: Stage_A data available && output is in saturation?
    //  [true]   Jump to [saturate]
    //  [false]  Loop back to init
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(sat, saturated)

not_saturated:
    // Clear saturation enable, otherwise jump will still require saturation flag
    acu(hold, hold) dmux(sa, sa) alu(englobals, 000) mac(hold)

    // Pipeline wait
    acu(hold, hold) dmux(sa, sa) alu(add) mac(hold)

    // Unconditional jump: return to [init]
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(eob, init)

saturated:
    // Clear saturation enable, otherwise jump will still require saturation flag
    acu(hold, hold) dmux(sa, sa) alu(englobals, 000) mac(hold)
    
    // Clear saturation flag, otherwise jump will still require saturation flag
    acu(hold, hold) dmux(sa, sa) alu(ensatrnd, 110) mac(hold)

    // Pipeline wait
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold)

    // Unconditional jump: return to [init]
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(eob, init)
  

State Diagrams

Jump Diagram

Your browser does not support SVG
Call Diagram for this program from the DFB Assembler Mini IDE