From c98881c5d7fddf2155217939de386afc1f406981 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Fri, 16 Oct 2020 18:51:51 -0600 Subject: [PATCH] passes quick test: slt, slti, sltu, sltiu --- hdl/core.v | 2 +- test/test.S | 57 +++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/hdl/core.v b/hdl/core.v index 5f44490..510bab4 100644 --- a/hdl/core.v +++ b/hdl/core.v @@ -218,7 +218,7 @@ always @(*) begin casex ({s_id_funct3, s_id_funct7}) 10'b000xxxxxxx: s_id_aluop = ALUOP_ADD; // ADDI 10'b010xxxxxxx: s_id_aluop = ALUOP_SLT; // SLTI - 10'b011xxxxxxx: s_id_aluop = ALUOP_SLTU; // SLTUI + 10'b011xxxxxxx: s_id_aluop = ALUOP_SLTU; // SLTIU 10'b100xxxxxxx: s_id_aluop = ALUOP_XOR; // XORI 10'b110xxxxxxx: s_id_aluop = ALUOP_OR; // ORI 10'b111xxxxxxx: s_id_aluop = ALUOP_AND; // ANDI diff --git a/test/test.S b/test/test.S index 4331036..9526359 100644 --- a/test/test.S +++ b/test/test.S @@ -8,12 +8,6 @@ _start: # JAL # JALR - # SLTI - # SLTUI - - # SLT - # SLTU - # lui lui x1, 0xfedcb # x1 = 0xfedcb000 nop @@ -154,6 +148,57 @@ _start: nop nop + # slti + addi x3, x0, 1 # x3 = 0x00000001 + addi x4, x0, 0x010 # x4 = 0x00000010 + addi x5, x0, 0x100 # x5 = 0x00000100 + nop + sub x6, x0, x3 # x6 = 0xffffffff + sub x7, x0, x4 # x7 = 0xfffffff0 + sub x8, x0, x5 # x7 = 0xffffff00 + nop + slti x9, x3, 0 # x9 = 0x00000000 + slti x10, x3, 1 # x10 = 0x00000000 + slti x11, x3, 2 # x11 = 0x00000001 + slti x12, x3, -1 # x12 = 0x00000000 + slti x13, x7, 0 # x13 = 0x00000001 + slti x14, x7, -17 # x14 = 0x00000000 + nop + nop + nop + + # sltiu + sltiu x15, x3, 0 # x15 = 0x00000000 + sltiu x16, x3, 1 # x16 = 0x00000000 + sltiu x17, x3, 2 # x17 = 0x00000001 + sltiu x18, x3, -1 # x18 = 0x00000001 # -1=0xffffffff + sltiu x19, x7, 0 # x19 = 0x00000000 + sltiu x20, x7, -15 # x20 = 0x00000001 # -15=0xfffffff1 + nop + nop + nop + + # slt + slt x21, x0, x3 # x21 = 0x00000001 + slt x22, x3, x0 # x22 = 0x00000000 + slt x23, x3, x3 # x23 = 0x00000000 + slt x24, x3, x6 # x24 = 0x00000000 + slt x25, x6, x3 # x25 = 0x00000001 + nop + nop + nop + + # sltu + sltu x26, x0, x3 # x26 = 0x00000001 + sltu x27, x3, x0 # x27 = 0x00000000 + sltu x28, x3, x3 # x28 = 0x00000000 + sltu x29, x3, x6 # x29 = 0x00000001 + sltu x30, x6, x3 # x30 = 0x00000000 + nop + nop + nop + + # counter and infinite loop nop nop