Advertisement
Guest User

Untitled

a guest
Jan 30th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bash-3.2$ diff -r ./R/lab3/MIPSLabs-master/ ./R/lab4/MIPSLabs-master/
  2. diff -r ./R/lab3/MIPSLabs-master/hdl/alu.v ./R/lab4/MIPSLabs-master/hdl/alu.v
  3. 6,9c6,11
  4. < module alu ( input      [4:0]  alu_ctl,
  5. <              input      [31:0] a_in, b_in,
  6. <              output reg [31:0] result,
  7. <              output            zero_flag );
  8. ---
  9. > module alu ( input      [6:0]  alu_ctl,
  10. >              input      [31:0] a_in,
  11. >                input  signed   [31:0] b_in,
  12. >               input [4:0] id_shamt,
  13. >              output reg signed [31:0] result,
  14. >              output            zero_flag);
  15. 17c19,22
  16. <                2:  result = a_in + b_in;         // addition
  17. ---
  18. >                2:  result = a_in + b_in;         // addition
  19. >                   3:  result = b_in >>> id_shamt;   // sra
  20. >                   4:  result = b_in << id_shamt ;   // sll
  21. >                   5:  result = b_in >> id_shamt ;   // srl
  22.  
  23.  
  24. diff -r ./R/lab3/MIPSLabs-master/hdl/alu_ctrl.v ./R/lab4/MIPSLabs-master/hdl/alu_ctrl.v
  25. 8c8,9
  26. <              output reg [4:0] alu_ctl );
  27. ---
  28. >              output reg [6:0] alu_ctl );
  29. >
  30. 11,13c12,14
  31. <           if(alu_op == 0)
  32. <                alu_ctl = 2;             // add
  33. <           else if(alu_op == 1)
  34. ---
  35. >           if(alu_op == 0) begin
  36. >                       alu_ctl = 2;             // add
  37. >           end else if(alu_op == 1)
  38. 15c16,19
  39. <           else case( func_code )
  40. ---
  41. >           else case( func_code )
  42. >                   0: alu_ctl = 4;       // sll
  43. >                   2: alu_ctl = 5;       // srl
  44. >                   3: alu_ctl = 3;       // sra
  45. 25,26c29,30
  46. <      end
  47. <
  48. ---
  49. >      end
  50. >
  51. diff -r ./R/lab3/MIPSLabs-master/hdl/control.v ./R/lab4/MIPSLabs-master/hdl/control.v
  52. 4c4,5
  53. <                 input            branch_eq,       // result of comparison for conditional branch
  54. ---
  55. >                 input            branch_eq,       // result of comparison for conditional branch
  56. >                    input [5:0] funct,
  57. 29c30,31
  58. <                     SLTI  = 6'b001010;
  59. ---
  60. >                     SLTI  = 6'b001010,
  61. >                         SLL   = 6'b000000;
  62. 55c57
  63. <           immediate_op = ( (opcode == ADDI) | (opcode == ANDI) | (opcode == ORI) | (opcode == XORI) | (opcode == SLTI) );
  64. ---
  65. >           immediate_op = ( (opcode == ADDI) | (opcode == ANDI) | (opcode == ORI) | (opcode == XORI) | (opcode == SLTI));
  66.  
  67.  
  68. diff -r ./R/lab3/MIPSLabs-master/hdl/ex_stage.v ./R/lab4/MIPSLabs-master/hdl/ex_stage.v
  69. 19c19,20
  70. <                  input [5:0]       opcode,
  71. ---
  72. >                  input [5:0]       opcode,
  73. >                     input [4:0]       id_shamt,
  74. 39c40,42
  75. <      wire [4:0]  alu_ctl;        // ALU control lines
  76. ---
  77. >      wire [6:0]  alu_ctl;        // ALU control lines
  78. >
  79. >       //wire [5:0]  func_code_sll;      // func code for ALU control
  80. 68c71,72
  81. <      assign func_code  = ex_imm_command ? {{2'b10},{~opcode[2] & opcode[1] & ~opcode[0]},opcode[2:0]} : func_field;
  82. ---
  83. >      assign func_code  = ex_imm_command ? {{2'b10},{~opcode[2] & opcode[1] & ~opcode[0]},opcode[2:0]} : func_field;
  84. >     //assign func_code_sll =
  85. 82c86,87
  86. <           .zero_flag (zero));
  87. ---
  88. >           .zero_flag (zero),
  89. >            .id_shamt(id_shamt));
  90.  
  91.  
  92. diff -r ./R/lab3/MIPSLabs-master/hdl/id_stage.v ./R/lab4/MIPSLabs-master/hdl/id_stage.v
  93. 22c22,23
  94. <                  output [5:0] id_opcode,
  95. ---
  96. >                  output [5:0] id_opcode,
  97. >                     output [4:0] id_shamt,
  98. 28c29,30
  99. <                  output reg [4:0]  ID_EX_rd,
  100. ---
  101. >                  output reg [4:0]  ID_EX_rd,
  102. >                     output reg [4:0]  ID_EX_shamt,
  103. 58c60,61
  104. <      wire        branch_eq;
  105. ---
  106. >      wire        branch_eq;
  107. >     wire [5:0]  funct;
  108. 98c101,103
  109. <      assign id_opcode = instruction[31:26];
  110. ---
  111. >      assign id_opcode = instruction[31:26];
  112. >     assign funct = instruction[5:0];
  113. >     assign id_shamt = instruction[10:6];
  114. 106c111,112
  115. <           .branch_eq( branch_eq ),
  116. ---
  117. >           .branch_eq( branch_eq ),
  118. >            .funct(funct),
  119. 126c132,133
  120. <                ID_EX_rd <= 0;
  121. ---
  122. >                ID_EX_rd <= 0;
  123. >                   ID_EX_shamt <= 0;
  124. 146c153
  125. <
  126. ---
  127. >                    ID_EX_shamt <= id_shamt;
  128.  
  129.  
  130. diff -r ./R/lab3/MIPSLabs-master/hdl/pipeline.v ./R/lab4/MIPSLabs-master/hdl/pipeline.v
  131. 39c39,40
  132. <      wire [5:0]  id_opcode;
  133. ---
  134. >      wire [5:0]  id_opcode;
  135. >     wire [4:0]  id_shamt;
  136. 55c56,57
  137. <      wire [5:0]  ID_EX_opcode;
  138. ---
  139. >      wire [5:0]  ID_EX_opcode;
  140. >     wire [4:0]  ID_EX_shamt;
  141. 152c154,155
  142. <           .id_opcode( id_opcode ),
  143. ---
  144. >           .id_opcode( id_opcode ),
  145. >            .id_shamt( id_shamt ),
  146. 158c161,162
  147. <           .ID_EX_rd ( ID_EX_rd ),
  148. ---
  149. >           .ID_EX_rd ( ID_EX_rd ),
  150. >            .ID_EX_shamt( ID_EX_shamt ),
  151. 194c198,199
  152. <           .opcode ( ID_EX_opcode ),
  153. ---
  154. >           .opcode ( ID_EX_opcode ),
  155. >            .id_shamt( ID_EX_shamt ),
  156.  
  157.  
  158. diff -r ./R/lab3/MIPSLabs-master/hdl/testbench.v ./R/lab4/MIPSLabs-master/hdl/testbench.v
  159. 43,45c43,44
  160. <           mips_clk = 0;
  161. <           sw[0] = 1;
  162. <
  163. ---
  164. >           mips_clk = 0;
  165. >
  166.  
  167.  
  168. diff -r ./R/lab3/MIPSLabs-master/sw/lab3.asm ./R/lab4/MIPSLabs-master/sw/lab3.asm
  169. 6c6
  170. <         .word 0xFFFF
  171. ---
  172. >         .word 0xFF0F
  173. 11,12c11,13
  174. <       lw $t0, 0x400  /* t0 = sw */
  175. <       sw $t0, 0x800  /* sw => ioctrl */
  176. ---
  177. >       lw $t0, 0x202  /* t0 = 1 */
  178. >       sw $t0, 0x400  /* led => gpio */
  179. >       sra $t0, $t0, 3  /* t0 = t0 << 2 */
  180. 14,17c15
  181. < led:
  182. <       lw $t2, 0x801  /* t2 = led */
  183. <       sw $t2, 0x400  /* led => gpio */
  184. <       j entry
  185. ---
  186. >       sw $t0, 0x400  /* led => gpio */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement