Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bash-3.2$ diff -r ./R/lab3/MIPSLabs-master/ ./R/lab4/MIPSLabs-master/
- diff -r ./R/lab3/MIPSLabs-master/hdl/alu.v ./R/lab4/MIPSLabs-master/hdl/alu.v
- 6,9c6,11
- < module alu ( input [4:0] alu_ctl,
- < input [31:0] a_in, b_in,
- < output reg [31:0] result,
- < output zero_flag );
- ---
- > module alu ( input [6:0] alu_ctl,
- > input [31:0] a_in,
- > input signed [31:0] b_in,
- > input [4:0] id_shamt,
- > output reg signed [31:0] result,
- > output zero_flag);
- 17c19,22
- < 2: result = a_in + b_in; // addition
- ---
- > 2: result = a_in + b_in; // addition
- > 3: result = b_in >>> id_shamt; // sra
- > 4: result = b_in << id_shamt ; // sll
- > 5: result = b_in >> id_shamt ; // srl
- diff -r ./R/lab3/MIPSLabs-master/hdl/alu_ctrl.v ./R/lab4/MIPSLabs-master/hdl/alu_ctrl.v
- 8c8,9
- < output reg [4:0] alu_ctl );
- ---
- > output reg [6:0] alu_ctl );
- >
- 11,13c12,14
- < if(alu_op == 0)
- < alu_ctl = 2; // add
- < else if(alu_op == 1)
- ---
- > if(alu_op == 0) begin
- > alu_ctl = 2; // add
- > end else if(alu_op == 1)
- 15c16,19
- < else case( func_code )
- ---
- > else case( func_code )
- > 0: alu_ctl = 4; // sll
- > 2: alu_ctl = 5; // srl
- > 3: alu_ctl = 3; // sra
- 25,26c29,30
- < end
- <
- ---
- > end
- >
- diff -r ./R/lab3/MIPSLabs-master/hdl/control.v ./R/lab4/MIPSLabs-master/hdl/control.v
- 4c4,5
- < input branch_eq, // result of comparison for conditional branch
- ---
- > input branch_eq, // result of comparison for conditional branch
- > input [5:0] funct,
- 29c30,31
- < SLTI = 6'b001010;
- ---
- > SLTI = 6'b001010,
- > SLL = 6'b000000;
- 55c57
- < immediate_op = ( (opcode == ADDI) | (opcode == ANDI) | (opcode == ORI) | (opcode == XORI) | (opcode == SLTI) );
- ---
- > immediate_op = ( (opcode == ADDI) | (opcode == ANDI) | (opcode == ORI) | (opcode == XORI) | (opcode == SLTI));
- diff -r ./R/lab3/MIPSLabs-master/hdl/ex_stage.v ./R/lab4/MIPSLabs-master/hdl/ex_stage.v
- 19c19,20
- < input [5:0] opcode,
- ---
- > input [5:0] opcode,
- > input [4:0] id_shamt,
- 39c40,42
- < wire [4:0] alu_ctl; // ALU control lines
- ---
- > wire [6:0] alu_ctl; // ALU control lines
- >
- > //wire [5:0] func_code_sll; // func code for ALU control
- 68c71,72
- < assign func_code = ex_imm_command ? {{2'b10},{~opcode[2] & opcode[1] & ~opcode[0]},opcode[2:0]} : func_field;
- ---
- > assign func_code = ex_imm_command ? {{2'b10},{~opcode[2] & opcode[1] & ~opcode[0]},opcode[2:0]} : func_field;
- > //assign func_code_sll =
- 82c86,87
- < .zero_flag (zero));
- ---
- > .zero_flag (zero),
- > .id_shamt(id_shamt));
- diff -r ./R/lab3/MIPSLabs-master/hdl/id_stage.v ./R/lab4/MIPSLabs-master/hdl/id_stage.v
- 22c22,23
- < output [5:0] id_opcode,
- ---
- > output [5:0] id_opcode,
- > output [4:0] id_shamt,
- 28c29,30
- < output reg [4:0] ID_EX_rd,
- ---
- > output reg [4:0] ID_EX_rd,
- > output reg [4:0] ID_EX_shamt,
- 58c60,61
- < wire branch_eq;
- ---
- > wire branch_eq;
- > wire [5:0] funct;
- 98c101,103
- < assign id_opcode = instruction[31:26];
- ---
- > assign id_opcode = instruction[31:26];
- > assign funct = instruction[5:0];
- > assign id_shamt = instruction[10:6];
- 106c111,112
- < .branch_eq( branch_eq ),
- ---
- > .branch_eq( branch_eq ),
- > .funct(funct),
- 126c132,133
- < ID_EX_rd <= 0;
- ---
- > ID_EX_rd <= 0;
- > ID_EX_shamt <= 0;
- 146c153
- <
- ---
- > ID_EX_shamt <= id_shamt;
- diff -r ./R/lab3/MIPSLabs-master/hdl/pipeline.v ./R/lab4/MIPSLabs-master/hdl/pipeline.v
- 39c39,40
- < wire [5:0] id_opcode;
- ---
- > wire [5:0] id_opcode;
- > wire [4:0] id_shamt;
- 55c56,57
- < wire [5:0] ID_EX_opcode;
- ---
- > wire [5:0] ID_EX_opcode;
- > wire [4:0] ID_EX_shamt;
- 152c154,155
- < .id_opcode( id_opcode ),
- ---
- > .id_opcode( id_opcode ),
- > .id_shamt( id_shamt ),
- 158c161,162
- < .ID_EX_rd ( ID_EX_rd ),
- ---
- > .ID_EX_rd ( ID_EX_rd ),
- > .ID_EX_shamt( ID_EX_shamt ),
- 194c198,199
- < .opcode ( ID_EX_opcode ),
- ---
- > .opcode ( ID_EX_opcode ),
- > .id_shamt( ID_EX_shamt ),
- diff -r ./R/lab3/MIPSLabs-master/hdl/testbench.v ./R/lab4/MIPSLabs-master/hdl/testbench.v
- 43,45c43,44
- < mips_clk = 0;
- < sw[0] = 1;
- <
- ---
- > mips_clk = 0;
- >
- diff -r ./R/lab3/MIPSLabs-master/sw/lab3.asm ./R/lab4/MIPSLabs-master/sw/lab3.asm
- 6c6
- < .word 0xFFFF
- ---
- > .word 0xFF0F
- 11,12c11,13
- < lw $t0, 0x400 /* t0 = sw */
- < sw $t0, 0x800 /* sw => ioctrl */
- ---
- > lw $t0, 0x202 /* t0 = 1 */
- > sw $t0, 0x400 /* led => gpio */
- > sra $t0, $t0, 3 /* t0 = t0 << 2 */
- 14,17c15
- < led:
- < lw $t2, 0x801 /* t2 = led */
- < sw $t2, 0x400 /* led => gpio */
- < j entry
- ---
- > sw $t0, 0x400 /* led => gpio */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement