-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSign_Extend.v
36 lines (30 loc) · 894 Bytes
/
Sign_Extend.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Alden Rivera 0416329
// Jorge Pineda 0416330
//Subject: CO project 2 - Sign extend
//--------------------------------------------------------------------------------
//Version: 1
//--------------------------------------------------------------------------------
//Writer:
//----------------------------------------------
//Date:
//----------------------------------------------
//Description:
//--------------------------------------------------------------------------------
module Sign_Extend(
data_i,
data_o
);
//I/O ports
input [16-1:0] data_i;
output [32-1:0] data_o;
//Internal Signals
reg [32-1:0] data_o;
//Sign extended
always@(*)
begin
if(data_i[15])
data_o = {16'b1111111111111111,data_i[15:0]};
else
data_o = {16'b0000000000000000,data_i[15:0]};
end
endmodule