SRISC6 CPU

I-Formatcodedescription
signedunsigned
br

unconditional
beq
a == ba equals b
bne
a != ba not equal to b
bltbltua < ba less than b
bgtbgtua > ba greater than b
blebleua <= ba not greater than b
bgebgeua >= ba not less than b

pseudo-instruction

blt rA, rB, label if (signed) rA < (signed) rB
then PC = PC + 4 + se(IMMED16)

I-Format Decoder

instopcodecontrolmuxi
br0x060x0800
cmpgei0x080x0b01
bge0x0E0x0b00
cmplti0x100x0a01
blt0x160x0a00
cmpnei0x180x0901
bne0x1E0x0900
cmpeqi0x200x0801
beq0x260x0800
cmpgeui0x280x0f01
bgeu0x2E0x0f00
cmpltui0x300x0e01
bltu0x360x0e00

controlinst controlinstcodedescription
0x0801000cmpeq


==a equals b
0x0901001cmpne


!=a not equal to b
0x0a01010cmplt 0x0e01110cmpltu <a less than b
0x0b01011cmpge 0x0f01111cmpgeu >=a not less than b

examine flags for ab (either signed or unsigned)
mode = control[2]? unsigned: signed
test = control[1]? neg: zero
cmp = control[0]? test: !test

muxi = 01comparerA compared to se(IMM16)
muxi = 00branchrA compared to rB

do_compare = control[5:3] == 3'b001
ibranch = do_compare && !muxc[0]

Branch Control Logic


next_pc = pc + 1'b1;
branch = (iflag? ibranch: 1'b0);

do_branch = branch&&cmp;
newpc = next_pc+(do_branch?immedse[9:2]:8'h00);

write_enable = !branch;


Maintained by John Loomis, last updated 24 October 2008