Perrine

MIPS MEMWB Buffer

Nov 26th, 2012
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module MEMWB(mem_control, mem_data, mem_address, mem_ALU,
  2.                 wb_control, wb_data, wb_address, wb_ALU);
  3.    
  4.     input mem_control, mem_data, mem_address, mem_ALU;
  5.     output wb_control, wb_data, wb_address, wb_ALU;
  6.    
  7.     wire[1:0] mem_control;
  8.     wire[4:0] mem_address;
  9.     wire[31:0] mem_ALU, mem_data;
  10.    
  11.     reg[1:0] int_control;
  12.     reg[4:0] int_address;
  13.     reg[31:0] int_ALU, int_data;
  14.    
  15.     reg[1:0] wb_control;
  16.     reg[4:0] wb_address;
  17.     reg[31:0] wb_ALU, wb_data;
  18.    
  19.     always@(posedge clk) begin
  20.         int_control = mem_control;
  21.         int_address = mem_address;
  22.         int_ALU = mem_ALU;
  23.         int_data = mem_data;
  24.     end
  25.    
  26.     always@(negedge clk) begin
  27.         wb_control = int_control;
  28.         wb_address = int_address;
  29.         wb_ALU = int_ALU;
  30.         wb_data = int_data;
  31.     end
  32. endmodule
Advertisement