passes quick test: slli, srli, srai

This commit is contained in:
2020-10-11 23:36:11 -06:00
parent 46a0972803
commit 913ffb3af6
2 changed files with 43 additions and 20 deletions

View File

@ -222,9 +222,9 @@ always @(*) begin
10'b100xxxxxxx: s_id_aluop = ALUOP_XOR; // XORI
10'b110xxxxxxx: s_id_aluop = ALUOP_OR; // ORI
10'b111xxxxxxx: s_id_aluop = ALUOP_AND; // ANDI
10'b0010000000: s_id_aluop = ALUOP_SL; // SLLI
10'b1010000000: s_id_aluop = ALUOP_SRL; // SRLI
10'b1010100000: s_id_aluop = ALUOP_SRA; // SRAI
10'b001000000x: s_id_aluop = ALUOP_SL; // SLLI // NOTE: technically s_id_funct7[0] must be 0 however GCC allows shifts of up to 63b despite assembling for 32b. I can tolerate this deviation from ISA spec at essentially no cost
10'b101000000x: s_id_aluop = ALUOP_SRL; // SRLI // NOTE: technically s_id_funct7[0] must be 0 however GCC allows shifts of up to 63b despite assembling for 32b. I can tolerate this deviation from ISA spec at essentially no cost
10'b101010000x: s_id_aluop = ALUOP_SRA; // SRAI // NOTE: technically s_id_funct7[0] must be 0 however GCC allows shifts of up to 63b despite assembling for 32b. I can tolerate this deviation from ISA spec at essentially no cost
default: begin
s_id_s1 = 32'hxxxxxxxx;
s_id_s2 = 32'hxxxxxxxx;
@ -312,10 +312,10 @@ always @(*) begin
s_ex_alu_out = s_ex_data1 << s_ex_data2;
end
ALUOP_SRL: begin
s_ex_alu_out = s_ex_data1 >> s_ex_data2;
s_ex_alu_out = s_ex_data1 >> s_ex_data2[5:0]; // NOTE: shamt is only 5 bits. Increased for gcc support
end
ALUOP_SRA: begin
s_ex_alu_out = s_ex_data1 >>> s_ex_data2;
s_ex_alu_out = $signed(s_ex_data1) >>> s_ex_data2[5:0]; // NOTE: shamt is only 5 bits. Increased for gcc support
end
ALUOP_SLT: begin
s_ex_alu_out = $signed(s_ex_data1) < $signed(s_ex_data2);