diff --git a/hdl/core.v b/hdl/core.v
index 8e8e5f4..5f44490 100644
--- a/hdl/core.v
+++ b/hdl/core.v
@@ -309,13 +309,13 @@ always @(*) begin
s_ex_alu_out = s_ex_data1 & s_ex_data2;
end
ALUOP_SL: begin
- s_ex_alu_out = s_ex_data1 << s_ex_data2;
+ s_ex_alu_out = s_ex_data1 << s_ex_data2[4:0];
end
ALUOP_SRL: begin
- s_ex_alu_out = s_ex_data1 >> s_ex_data2[5:0]; // NOTE: shamt is only 5 bits. Increased for gcc support
+ s_ex_alu_out = s_ex_data1 >> s_ex_data2[4:0];
end
ALUOP_SRA: begin
- s_ex_alu_out = $signed(s_ex_data1) >>> s_ex_data2[5:0]; // NOTE: shamt is only 5 bits. Increased for gcc support
+ s_ex_alu_out = $signed(s_ex_data1) >>> s_ex_data2[4:0];
end
ALUOP_SLT: begin
s_ex_alu_out = $signed(s_ex_data1) < $signed(s_ex_data2);
diff --git a/sim/core_tb.wcfg b/sim/core_tb.wcfg
index fb35126..11be306 100644
--- a/sim/core_tb.wcfg
+++ b/sim/core_tb.wcfg
@@ -10,7 +10,7 @@
-
+
clk
clk
@@ -19,1291 +19,6 @@
reset
reset
-
- mem_inst[0:255,31:0]
- mem_inst[0:255,31:0]
- HEXRADIX
-
- [0,31:0]
- mem_inst[0,31:0]
- HEXRADIX
-
-
- [1,31:0]
- mem_inst[1,31:0]
- HEXRADIX
-
-
- [2,31:0]
- mem_inst[2,31:0]
- HEXRADIX
-
-
- [3,31:0]
- mem_inst[3,31:0]
- HEXRADIX
-
-
- [4,31:0]
- mem_inst[4,31:0]
- HEXRADIX
-
-
- [5,31:0]
- mem_inst[5,31:0]
- HEXRADIX
-
-
- [6,31:0]
- mem_inst[6,31:0]
- HEXRADIX
-
-
- [7,31:0]
- mem_inst[7,31:0]
- HEXRADIX
-
-
- [8,31:0]
- mem_inst[8,31:0]
- HEXRADIX
-
-
- [9,31:0]
- mem_inst[9,31:0]
- HEXRADIX
-
-
- [10,31:0]
- mem_inst[10,31:0]
- HEXRADIX
-
-
- [11,31:0]
- mem_inst[11,31:0]
- HEXRADIX
-
-
- [12,31:0]
- mem_inst[12,31:0]
- HEXRADIX
-
-
- [13,31:0]
- mem_inst[13,31:0]
- HEXRADIX
-
-
- [14,31:0]
- mem_inst[14,31:0]
- HEXRADIX
-
-
- [15,31:0]
- mem_inst[15,31:0]
- HEXRADIX
-
-
- [16,31:0]
- mem_inst[16,31:0]
- HEXRADIX
-
-
- [17,31:0]
- mem_inst[17,31:0]
- HEXRADIX
-
-
- [18,31:0]
- mem_inst[18,31:0]
- HEXRADIX
-
-
- [19,31:0]
- mem_inst[19,31:0]
- HEXRADIX
-
-
- [20,31:0]
- mem_inst[20,31:0]
- HEXRADIX
-
-
- [21,31:0]
- mem_inst[21,31:0]
- HEXRADIX
-
-
- [22,31:0]
- mem_inst[22,31:0]
- HEXRADIX
-
-
- [23,31:0]
- mem_inst[23,31:0]
- HEXRADIX
-
-
- [24,31:0]
- mem_inst[24,31:0]
- HEXRADIX
-
-
- [25,31:0]
- mem_inst[25,31:0]
- HEXRADIX
-
-
- [26,31:0]
- mem_inst[26,31:0]
- HEXRADIX
-
-
- [27,31:0]
- mem_inst[27,31:0]
- HEXRADIX
-
-
- [28,31:0]
- mem_inst[28,31:0]
- HEXRADIX
-
-
- [29,31:0]
- mem_inst[29,31:0]
- HEXRADIX
-
-
- [30,31:0]
- mem_inst[30,31:0]
- HEXRADIX
-
-
- [31,31:0]
- mem_inst[31,31:0]
- HEXRADIX
-
-
- [32,31:0]
- mem_inst[32,31:0]
- HEXRADIX
-
-
- [33,31:0]
- mem_inst[33,31:0]
- HEXRADIX
-
-
- [34,31:0]
- mem_inst[34,31:0]
- HEXRADIX
-
-
- [35,31:0]
- mem_inst[35,31:0]
- HEXRADIX
-
-
- [36,31:0]
- mem_inst[36,31:0]
- HEXRADIX
-
-
- [37,31:0]
- mem_inst[37,31:0]
- HEXRADIX
-
-
- [38,31:0]
- mem_inst[38,31:0]
- HEXRADIX
-
-
- [39,31:0]
- mem_inst[39,31:0]
- HEXRADIX
-
-
- [40,31:0]
- mem_inst[40,31:0]
- HEXRADIX
-
-
- [41,31:0]
- mem_inst[41,31:0]
- HEXRADIX
-
-
- [42,31:0]
- mem_inst[42,31:0]
- HEXRADIX
-
-
- [43,31:0]
- mem_inst[43,31:0]
- HEXRADIX
-
-
- [44,31:0]
- mem_inst[44,31:0]
- HEXRADIX
-
-
- [45,31:0]
- mem_inst[45,31:0]
- HEXRADIX
-
-
- [46,31:0]
- mem_inst[46,31:0]
- HEXRADIX
-
-
- [47,31:0]
- mem_inst[47,31:0]
- HEXRADIX
-
-
- [48,31:0]
- mem_inst[48,31:0]
- HEXRADIX
-
-
- [49,31:0]
- mem_inst[49,31:0]
- HEXRADIX
-
-
- [50,31:0]
- mem_inst[50,31:0]
- HEXRADIX
-
-
- [51,31:0]
- mem_inst[51,31:0]
- HEXRADIX
-
-
- [52,31:0]
- mem_inst[52,31:0]
- HEXRADIX
-
-
- [53,31:0]
- mem_inst[53,31:0]
- HEXRADIX
-
-
- [54,31:0]
- mem_inst[54,31:0]
- HEXRADIX
-
-
- [55,31:0]
- mem_inst[55,31:0]
- HEXRADIX
-
-
- [56,31:0]
- mem_inst[56,31:0]
- HEXRADIX
-
-
- [57,31:0]
- mem_inst[57,31:0]
- HEXRADIX
-
-
- [58,31:0]
- mem_inst[58,31:0]
- HEXRADIX
-
-
- [59,31:0]
- mem_inst[59,31:0]
- HEXRADIX
-
-
- [60,31:0]
- mem_inst[60,31:0]
- HEXRADIX
-
-
- [61,31:0]
- mem_inst[61,31:0]
- HEXRADIX
-
-
- [62,31:0]
- mem_inst[62,31:0]
- HEXRADIX
-
-
- [63,31:0]
- mem_inst[63,31:0]
- HEXRADIX
-
-
- [64,31:0]
- mem_inst[64,31:0]
- HEXRADIX
-
-
- [65,31:0]
- mem_inst[65,31:0]
- HEXRADIX
-
-
- [66,31:0]
- mem_inst[66,31:0]
- HEXRADIX
-
-
- [67,31:0]
- mem_inst[67,31:0]
- HEXRADIX
-
-
- [68,31:0]
- mem_inst[68,31:0]
- HEXRADIX
-
-
- [69,31:0]
- mem_inst[69,31:0]
- HEXRADIX
-
-
- [70,31:0]
- mem_inst[70,31:0]
- HEXRADIX
-
-
- [71,31:0]
- mem_inst[71,31:0]
- HEXRADIX
-
-
- [72,31:0]
- mem_inst[72,31:0]
- HEXRADIX
-
-
- [73,31:0]
- mem_inst[73,31:0]
- HEXRADIX
-
-
- [74,31:0]
- mem_inst[74,31:0]
- HEXRADIX
-
-
- [75,31:0]
- mem_inst[75,31:0]
- HEXRADIX
-
-
- [76,31:0]
- mem_inst[76,31:0]
- HEXRADIX
-
-
- [77,31:0]
- mem_inst[77,31:0]
- HEXRADIX
-
-
- [78,31:0]
- mem_inst[78,31:0]
- HEXRADIX
-
-
- [79,31:0]
- mem_inst[79,31:0]
- HEXRADIX
-
-
- [80,31:0]
- mem_inst[80,31:0]
- HEXRADIX
-
-
- [81,31:0]
- mem_inst[81,31:0]
- HEXRADIX
-
-
- [82,31:0]
- mem_inst[82,31:0]
- HEXRADIX
-
-
- [83,31:0]
- mem_inst[83,31:0]
- HEXRADIX
-
-
- [84,31:0]
- mem_inst[84,31:0]
- HEXRADIX
-
-
- [85,31:0]
- mem_inst[85,31:0]
- HEXRADIX
-
-
- [86,31:0]
- mem_inst[86,31:0]
- HEXRADIX
-
-
- [87,31:0]
- mem_inst[87,31:0]
- HEXRADIX
-
-
- [88,31:0]
- mem_inst[88,31:0]
- HEXRADIX
-
-
- [89,31:0]
- mem_inst[89,31:0]
- HEXRADIX
-
-
- [90,31:0]
- mem_inst[90,31:0]
- HEXRADIX
-
-
- [91,31:0]
- mem_inst[91,31:0]
- HEXRADIX
-
-
- [92,31:0]
- mem_inst[92,31:0]
- HEXRADIX
-
-
- [93,31:0]
- mem_inst[93,31:0]
- HEXRADIX
-
-
- [94,31:0]
- mem_inst[94,31:0]
- HEXRADIX
-
-
- [95,31:0]
- mem_inst[95,31:0]
- HEXRADIX
-
-
- [96,31:0]
- mem_inst[96,31:0]
- HEXRADIX
-
-
- [97,31:0]
- mem_inst[97,31:0]
- HEXRADIX
-
-
- [98,31:0]
- mem_inst[98,31:0]
- HEXRADIX
-
-
- [99,31:0]
- mem_inst[99,31:0]
- HEXRADIX
-
-
- [100,31:0]
- mem_inst[100,31:0]
- HEXRADIX
-
-
- [101,31:0]
- mem_inst[101,31:0]
- HEXRADIX
-
-
- [102,31:0]
- mem_inst[102,31:0]
- HEXRADIX
-
-
- [103,31:0]
- mem_inst[103,31:0]
- HEXRADIX
-
-
- [104,31:0]
- mem_inst[104,31:0]
- HEXRADIX
-
-
- [105,31:0]
- mem_inst[105,31:0]
- HEXRADIX
-
-
- [106,31:0]
- mem_inst[106,31:0]
- HEXRADIX
-
-
- [107,31:0]
- mem_inst[107,31:0]
- HEXRADIX
-
-
- [108,31:0]
- mem_inst[108,31:0]
- HEXRADIX
-
-
- [109,31:0]
- mem_inst[109,31:0]
- HEXRADIX
-
-
- [110,31:0]
- mem_inst[110,31:0]
- HEXRADIX
-
-
- [111,31:0]
- mem_inst[111,31:0]
- HEXRADIX
-
-
- [112,31:0]
- mem_inst[112,31:0]
- HEXRADIX
-
-
- [113,31:0]
- mem_inst[113,31:0]
- HEXRADIX
-
-
- [114,31:0]
- mem_inst[114,31:0]
- HEXRADIX
-
-
- [115,31:0]
- mem_inst[115,31:0]
- HEXRADIX
-
-
- [116,31:0]
- mem_inst[116,31:0]
- HEXRADIX
-
-
- [117,31:0]
- mem_inst[117,31:0]
- HEXRADIX
-
-
- [118,31:0]
- mem_inst[118,31:0]
- HEXRADIX
-
-
- [119,31:0]
- mem_inst[119,31:0]
- HEXRADIX
-
-
- [120,31:0]
- mem_inst[120,31:0]
- HEXRADIX
-
-
- [121,31:0]
- mem_inst[121,31:0]
- HEXRADIX
-
-
- [122,31:0]
- mem_inst[122,31:0]
- HEXRADIX
-
-
- [123,31:0]
- mem_inst[123,31:0]
- HEXRADIX
-
-
- [124,31:0]
- mem_inst[124,31:0]
- HEXRADIX
-
-
- [125,31:0]
- mem_inst[125,31:0]
- HEXRADIX
-
-
- [126,31:0]
- mem_inst[126,31:0]
- HEXRADIX
-
-
- [127,31:0]
- mem_inst[127,31:0]
- HEXRADIX
-
-
- [128,31:0]
- mem_inst[128,31:0]
- HEXRADIX
-
-
- [129,31:0]
- mem_inst[129,31:0]
- HEXRADIX
-
-
- [130,31:0]
- mem_inst[130,31:0]
- HEXRADIX
-
-
- [131,31:0]
- mem_inst[131,31:0]
- HEXRADIX
-
-
- [132,31:0]
- mem_inst[132,31:0]
- HEXRADIX
-
-
- [133,31:0]
- mem_inst[133,31:0]
- HEXRADIX
-
-
- [134,31:0]
- mem_inst[134,31:0]
- HEXRADIX
-
-
- [135,31:0]
- mem_inst[135,31:0]
- HEXRADIX
-
-
- [136,31:0]
- mem_inst[136,31:0]
- HEXRADIX
-
-
- [137,31:0]
- mem_inst[137,31:0]
- HEXRADIX
-
-
- [138,31:0]
- mem_inst[138,31:0]
- HEXRADIX
-
-
- [139,31:0]
- mem_inst[139,31:0]
- HEXRADIX
-
-
- [140,31:0]
- mem_inst[140,31:0]
- HEXRADIX
-
-
- [141,31:0]
- mem_inst[141,31:0]
- HEXRADIX
-
-
- [142,31:0]
- mem_inst[142,31:0]
- HEXRADIX
-
-
- [143,31:0]
- mem_inst[143,31:0]
- HEXRADIX
-
-
- [144,31:0]
- mem_inst[144,31:0]
- HEXRADIX
-
-
- [145,31:0]
- mem_inst[145,31:0]
- HEXRADIX
-
-
- [146,31:0]
- mem_inst[146,31:0]
- HEXRADIX
-
-
- [147,31:0]
- mem_inst[147,31:0]
- HEXRADIX
-
-
- [148,31:0]
- mem_inst[148,31:0]
- HEXRADIX
-
-
- [149,31:0]
- mem_inst[149,31:0]
- HEXRADIX
-
-
- [150,31:0]
- mem_inst[150,31:0]
- HEXRADIX
-
-
- [151,31:0]
- mem_inst[151,31:0]
- HEXRADIX
-
-
- [152,31:0]
- mem_inst[152,31:0]
- HEXRADIX
-
-
- [153,31:0]
- mem_inst[153,31:0]
- HEXRADIX
-
-
- [154,31:0]
- mem_inst[154,31:0]
- HEXRADIX
-
-
- [155,31:0]
- mem_inst[155,31:0]
- HEXRADIX
-
-
- [156,31:0]
- mem_inst[156,31:0]
- HEXRADIX
-
-
- [157,31:0]
- mem_inst[157,31:0]
- HEXRADIX
-
-
- [158,31:0]
- mem_inst[158,31:0]
- HEXRADIX
-
-
- [159,31:0]
- mem_inst[159,31:0]
- HEXRADIX
-
-
- [160,31:0]
- mem_inst[160,31:0]
- HEXRADIX
-
-
- [161,31:0]
- mem_inst[161,31:0]
- HEXRADIX
-
-
- [162,31:0]
- mem_inst[162,31:0]
- HEXRADIX
-
-
- [163,31:0]
- mem_inst[163,31:0]
- HEXRADIX
-
-
- [164,31:0]
- mem_inst[164,31:0]
- HEXRADIX
-
-
- [165,31:0]
- mem_inst[165,31:0]
- HEXRADIX
-
-
- [166,31:0]
- mem_inst[166,31:0]
- HEXRADIX
-
-
- [167,31:0]
- mem_inst[167,31:0]
- HEXRADIX
-
-
- [168,31:0]
- mem_inst[168,31:0]
- HEXRADIX
-
-
- [169,31:0]
- mem_inst[169,31:0]
- HEXRADIX
-
-
- [170,31:0]
- mem_inst[170,31:0]
- HEXRADIX
-
-
- [171,31:0]
- mem_inst[171,31:0]
- HEXRADIX
-
-
- [172,31:0]
- mem_inst[172,31:0]
- HEXRADIX
-
-
- [173,31:0]
- mem_inst[173,31:0]
- HEXRADIX
-
-
- [174,31:0]
- mem_inst[174,31:0]
- HEXRADIX
-
-
- [175,31:0]
- mem_inst[175,31:0]
- HEXRADIX
-
-
- [176,31:0]
- mem_inst[176,31:0]
- HEXRADIX
-
-
- [177,31:0]
- mem_inst[177,31:0]
- HEXRADIX
-
-
- [178,31:0]
- mem_inst[178,31:0]
- HEXRADIX
-
-
- [179,31:0]
- mem_inst[179,31:0]
- HEXRADIX
-
-
- [180,31:0]
- mem_inst[180,31:0]
- HEXRADIX
-
-
- [181,31:0]
- mem_inst[181,31:0]
- HEXRADIX
-
-
- [182,31:0]
- mem_inst[182,31:0]
- HEXRADIX
-
-
- [183,31:0]
- mem_inst[183,31:0]
- HEXRADIX
-
-
- [184,31:0]
- mem_inst[184,31:0]
- HEXRADIX
-
-
- [185,31:0]
- mem_inst[185,31:0]
- HEXRADIX
-
-
- [186,31:0]
- mem_inst[186,31:0]
- HEXRADIX
-
-
- [187,31:0]
- mem_inst[187,31:0]
- HEXRADIX
-
-
- [188,31:0]
- mem_inst[188,31:0]
- HEXRADIX
-
-
- [189,31:0]
- mem_inst[189,31:0]
- HEXRADIX
-
-
- [190,31:0]
- mem_inst[190,31:0]
- HEXRADIX
-
-
- [191,31:0]
- mem_inst[191,31:0]
- HEXRADIX
-
-
- [192,31:0]
- mem_inst[192,31:0]
- HEXRADIX
-
-
- [193,31:0]
- mem_inst[193,31:0]
- HEXRADIX
-
-
- [194,31:0]
- mem_inst[194,31:0]
- HEXRADIX
-
-
- [195,31:0]
- mem_inst[195,31:0]
- HEXRADIX
-
-
- [196,31:0]
- mem_inst[196,31:0]
- HEXRADIX
-
-
- [197,31:0]
- mem_inst[197,31:0]
- HEXRADIX
-
-
- [198,31:0]
- mem_inst[198,31:0]
- HEXRADIX
-
-
- [199,31:0]
- mem_inst[199,31:0]
- HEXRADIX
-
-
- [200,31:0]
- mem_inst[200,31:0]
- HEXRADIX
-
-
- [201,31:0]
- mem_inst[201,31:0]
- HEXRADIX
-
-
- [202,31:0]
- mem_inst[202,31:0]
- HEXRADIX
-
-
- [203,31:0]
- mem_inst[203,31:0]
- HEXRADIX
-
-
- [204,31:0]
- mem_inst[204,31:0]
- HEXRADIX
-
-
- [205,31:0]
- mem_inst[205,31:0]
- HEXRADIX
-
-
- [206,31:0]
- mem_inst[206,31:0]
- HEXRADIX
-
-
- [207,31:0]
- mem_inst[207,31:0]
- HEXRADIX
-
-
- [208,31:0]
- mem_inst[208,31:0]
- HEXRADIX
-
-
- [209,31:0]
- mem_inst[209,31:0]
- HEXRADIX
-
-
- [210,31:0]
- mem_inst[210,31:0]
- HEXRADIX
-
-
- [211,31:0]
- mem_inst[211,31:0]
- HEXRADIX
-
-
- [212,31:0]
- mem_inst[212,31:0]
- HEXRADIX
-
-
- [213,31:0]
- mem_inst[213,31:0]
- HEXRADIX
-
-
- [214,31:0]
- mem_inst[214,31:0]
- HEXRADIX
-
-
- [215,31:0]
- mem_inst[215,31:0]
- HEXRADIX
-
-
- [216,31:0]
- mem_inst[216,31:0]
- HEXRADIX
-
-
- [217,31:0]
- mem_inst[217,31:0]
- HEXRADIX
-
-
- [218,31:0]
- mem_inst[218,31:0]
- HEXRADIX
-
-
- [219,31:0]
- mem_inst[219,31:0]
- HEXRADIX
-
-
- [220,31:0]
- mem_inst[220,31:0]
- HEXRADIX
-
-
- [221,31:0]
- mem_inst[221,31:0]
- HEXRADIX
-
-
- [222,31:0]
- mem_inst[222,31:0]
- HEXRADIX
-
-
- [223,31:0]
- mem_inst[223,31:0]
- HEXRADIX
-
-
- [224,31:0]
- mem_inst[224,31:0]
- HEXRADIX
-
-
- [225,31:0]
- mem_inst[225,31:0]
- HEXRADIX
-
-
- [226,31:0]
- mem_inst[226,31:0]
- HEXRADIX
-
-
- [227,31:0]
- mem_inst[227,31:0]
- HEXRADIX
-
-
- [228,31:0]
- mem_inst[228,31:0]
- HEXRADIX
-
-
- [229,31:0]
- mem_inst[229,31:0]
- HEXRADIX
-
-
- [230,31:0]
- mem_inst[230,31:0]
- HEXRADIX
-
-
- [231,31:0]
- mem_inst[231,31:0]
- HEXRADIX
-
-
- [232,31:0]
- mem_inst[232,31:0]
- HEXRADIX
-
-
- [233,31:0]
- mem_inst[233,31:0]
- HEXRADIX
-
-
- [234,31:0]
- mem_inst[234,31:0]
- HEXRADIX
-
-
- [235,31:0]
- mem_inst[235,31:0]
- HEXRADIX
-
-
- [236,31:0]
- mem_inst[236,31:0]
- HEXRADIX
-
-
- [237,31:0]
- mem_inst[237,31:0]
- HEXRADIX
-
-
- [238,31:0]
- mem_inst[238,31:0]
- HEXRADIX
-
-
- [239,31:0]
- mem_inst[239,31:0]
- HEXRADIX
-
-
- [240,31:0]
- mem_inst[240,31:0]
- HEXRADIX
-
-
- [241,31:0]
- mem_inst[241,31:0]
- HEXRADIX
-
-
- [242,31:0]
- mem_inst[242,31:0]
- HEXRADIX
-
-
- [243,31:0]
- mem_inst[243,31:0]
- HEXRADIX
-
-
- [244,31:0]
- mem_inst[244,31:0]
- HEXRADIX
-
-
- [245,31:0]
- mem_inst[245,31:0]
- HEXRADIX
-
-
- [246,31:0]
- mem_inst[246,31:0]
- HEXRADIX
-
-
- [247,31:0]
- mem_inst[247,31:0]
- HEXRADIX
-
-
- [248,31:0]
- mem_inst[248,31:0]
- HEXRADIX
-
-
- [249,31:0]
- mem_inst[249,31:0]
- HEXRADIX
-
-
- [250,31:0]
- mem_inst[250,31:0]
- HEXRADIX
-
-
- [251,31:0]
- mem_inst[251,31:0]
- HEXRADIX
-
-
- [252,31:0]
- mem_inst[252,31:0]
- HEXRADIX
-
-
- [253,31:0]
- mem_inst[253,31:0]
- HEXRADIX
-
-
- [254,31:0]
- mem_inst[254,31:0]
- HEXRADIX
-
-
- [255,31:0]
- mem_inst[255,31:0]
- HEXRADIX
-
-
regfile[0:31,31:0]
regfile[0:31,31:0]
@@ -1547,8 +262,8 @@
HEXRADIX
- s_id_aluop[2:0]
- s_id_aluop[2:0]
+ s_id_aluop[3:0]
+ s_id_aluop[3:0]
s_id_alu_seed
@@ -1600,8 +315,8 @@
HEXRADIX
- r_ex_aluop[2:0]
- r_ex_aluop[2:0]
+ r_ex_aluop[3:0]
+ r_ex_aluop[3:0]
r_ex_alu_seed
diff --git a/test/test.S b/test/test.S
index 88bbae3..4331036 100644
--- a/test/test.S
+++ b/test/test.S
@@ -11,9 +11,6 @@ _start:
# SLTI
# SLTUI
- # SLL
- # SRL
- # SRA
# SLT
# SLTU
@@ -96,7 +93,7 @@ _start:
# slli
slli x24, x23, 4 # x24 = 0x00007880
slli x25, x2, 1 # x25 = 0xfffffffe
- slli x26, x2, 63 # x26 = 0x00000000 // NOTE: I would expect GCC to throw an error here. It tolerates up to 63 bit shift despite assembling for 32b
+ slli x26, x2, 63 # x26 = 0x80000000 # NOTE: gcc should not allow this since shamt is only 5 bits. discarding high bit so 63 = 31
slli x27, x2, 31 # x27 = 0x80000000
nop
nop
@@ -105,17 +102,54 @@ _start:
# srli
srli x28, x23, 4 # x28 = 0x00000078
srli x29, x2, 1 # x29 = 0x7fffffff
- srli x30, x2, 63 # x30 = 0x00000000 // NOTE: I would expect GCC to throw an error here. It tolerates up to 63 bit shift despite assembling for 32b
+ srli x30, x2, 63 # x30 = 0x00000001 # NOTE: gcc should not allow this since shamt is only 5 bits. discarding high bit so 63 = 31
srli x3, x2, 31 # x3 = 0x00000001
nop
nop
nop
# srai
- srai x4, x23, 4 # x4 = 0x00000078 // fails
- srai x5, x2, 1 # x5 = 0xffffffff
- srai x6, x2, 63 # x6 = 0xffffffff // NOTE: I would expect GCC to throw an error here. It tolerates up to 63 bit shift despite assembling for 32b
- srai x7, x2, 31 # x7 = 0xffffffff
+ srai x4, x23, 4 # x4 = 0x00000078
+ srai x5, x2, 1 # x5 = 0xffffffff
+ srai x6, x2, 63 # x6 = 0xffffffff # NOTE: gcc should not allow this since shamt is only 5 bits. discarding high bit so 63 = 31
+ srai x7, x2, 31 # x7 = 0xffffffff
+ nop
+ nop
+ nop
+
+ # sll
+ addi x8, x0, 4 # x8 = 0x00000004
+ addi x9, x0, 1 # x9 = 0x00000001
+ addi x10, x0, 63 # x10 = 0x0000003f
+ addi x11, x0, 31 # x11 = 0x0000001f
+ sll x12, x23, x8 # x12 = 0x00007880 # 4
+ sll x13, x2, x9 # x13 = 0xfffffffe # 1
+ sll x14, x2, x10 # x14 = 0x80000000 # 63 = 31
+ sll x15, x2, x11 # x15 = 0x80000000 # 31
+ sll x16, x1, x0 # x16 = 0xfedcb789 # 0
+ sll x17, x1, x2 # x17 = 0x80000000 # -1=31
+ nop
+ nop
+ nop
+
+ # srl
+ srl x18, x23, x8 # x18 = 0x00000078 # 4
+ srl x19, x2, x9 # x17 = 0x7fffffff # 1
+ srl x20, x2, x10 # x20 = 0x00000001 # 63 = 31
+ srl x21, x2, x11 # x21 = 0x00000001 # 31
+ srl x22, x1, x0 # x22 = 0xfedcb789 # 0
+ srl x24, x1, x2 # x24 = 0x00000001 # -1=31
+ nop
+ nop
+ nop
+
+ # sra
+ sra x25, x23, x8 # x25 = 0x00000078 # 4
+ sra x26, x2, x9 # x26 = 0xffffffff # 1
+ sra x27, x2, x10 # x27 = 0xffffffff # 63 = 31
+ sra x28, x2, x11 # x28 = 0xffffffff # 31
+ sra x29, x1, x0 # x29 = 0xfedcb789 # 0
+ sra x30, x1, x2 # x30 = 0xffffffff # -1=31
nop
nop
nop