Advertisement
MBJ

Constant Unit

MBJ
Apr 22nd, 2019
1,294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. `timescale 1ns / 1ps
  2.  
  3. // in the DECODER AND OPERAND FETCH phase
  4. // extends the IMMEDIATE from 15 bit to 32 bit
  5.  
  6. // depending on CS bit, extends the sign bit (not sure which, COME BACK AND FIND OUT!!)
  7.  
  8.  
  9. module Constant_unit(
  10.                     input [14:0] IM,
  11.                     input CS,
  12.                     output reg [31:0] CONST_DATA
  13.                     );
  14.  
  15.  
  16. always@(*) begin
  17.     CONST_DATA = IM;
  18.     CONST_DATA[31] = (CS)? IM[14]: 0 ;  // in tables, CS = 1 for sign extended IM
  19. end
  20.  
  21. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement