Datapath equity jump

Example of using datapath equity flag to branch (asserted when the ALU hardware detects an output value of zero)

Download this project

Program Listing

    // [title] Datapath equity jump
// [brief] Example of using datapath equity flag to branch (asserted when the ALU hardware detects an output value of zero)
// [categories] Examples - jump conditions

init:
    // ----------------------------------------
    // Load the next Stage_A value and subtract
    // [SUBTRACTION_VAL_1] in DataRam_A from it
    // ----------------------------------------

    // Initialize
    // [acu]    Ensure we are positioned on [SUBTRACTION_VAL_1] at 0x00
    acu(clear, clear) dmux(sa, sa) alu(hold) mac(hold)
        
    // [dmux].a     Set up to read bus Stage_A to ALU
    // [dmux].b     Set up to read [SUBTRACTION_VAL_1] from DataRam_A to ALU
    // [alu]        Set up to subtract b from a with threshold detection
    acu(hold, hold) addr(1) dmux(ba, sra) alu(tsubb) mac(hold)

    // Pipeline delay
    // [alu]        Data values are loaded off the datapath from Stage_A for tsubb op (2-cycle instruction delay)
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold)

    // Conditional jump: Is datapath equal to zero?
    //              [true]: Go to [datapath_equals_zero]
    //              [false]:Fall through to datapath_not_equal_zero
    // [alu]        ALU output is put on the datapath for tsub op (2-cycle instruction delay)
    acu(hold, hold) dmux(sa, sa) alu(hold) mac(hold) jmp(dpeq, datapath_equals_zero)

datapath_not_equal_zero:
    // --------------------------------------------------
    // This branch is entered when [alu].a - [alu].b >= 0
    // --------------------------------------------------

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

datapath_equals_zero:
    // --------------------------------------------------
    // This branch is entered when [alu].a - [alu].b < 0
    // --------------------------------------------------

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

area data_b
org 0
dw 0x000004    // [SUBTRACTION_VAL_1]

  

State Diagrams

Jump Diagram

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