Advertisement
MBJ

Decoded Operand Fetch

MBJ
Apr 22nd, 2019
1,366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns/1ps
  2.  
  3. module Decoded_operand_fetch(
  4.                             input [31:0] IR,    //32 bit
  5.                             input [31:0] PC_1,
  6.                             input [31:0] A_DATA, B_DATA,    // driven by wires in top module, outputted from reg files
  7.                             // IO
  8.                             output [31:0] Bus_A, Bus_B,
  9.                             output RW, PS, MW,
  10.                             output [4:0] DA, FS,
  11.                             output reg [4:0] SH,
  12.                             output [1:0] MD, BS,    // MD goes to MD_1, BS goes to top phase
  13.                             output [4:0] AAnet, BAnet   // nets because they come from lower modules to be implemented in next modules
  14.                             );
  15.  
  16. wire MA, MB, CS;
  17. wire [31:0] CONST_DATA;
  18. reg [14:0] IM = 0;
  19.  
  20. always@(*) begin
  21.     IM = IR[14:0];  // 15 LSB's of IR
  22.     SH = IR[4:0];   // 5 LSB's of IR
  23. end
  24. // reg file will output two data busses (A and B)
  25.     // they will output, which drive wires in top module to this one
  26.     // those wired inputs will exist solely as inputs here
  27. // module instantiation
  28.  
  29. Constant_unit CU0(
  30.                     .IM(IM), .CS(CS),
  31.                     // IO
  32.                     .CONST_DATA(CONST_DATA)
  33.                     );
  34.  
  35. MUX_A MA0(
  36.             .MA(MA), .PC_1(PC_1),
  37.             .A_DATA(A_DATA),
  38.             // IO
  39.             .Bus_A(Bus_A)
  40.             );
  41.  
  42. MUX_B MB0(
  43.             .MB(MB), .CONST_DATA(CONST_DATA),
  44.             .B_DATA(B_DATA),
  45.             // IO
  46.             .Bus_B(Bus_B)
  47.             );
  48.  
  49. Instruction_decoder ID0(    // not built yet
  50.                         .IR(IR),
  51.                         // IO
  52.                         .RW(RW), .DA(DA), .MD(MD),
  53.                         .BS(BS), .PS(PS), .MW(MW),
  54.                         .FS(FS), .MA(MA), .MB(MB),
  55.                         .AA(AAnet), .BA(BAnet),
  56.                         .CS(CS)
  57.                         );
  58.  
  59. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement