-
Notifications
You must be signed in to change notification settings - Fork 0
/
Normalization1.v
81 lines (77 loc) · 1.42 KB
/
Normalization1.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*----------------------------
Module : Normalization1
Designed by : Akhil Gudivada
-------------------------------*/
module Normalization1 (input [11:0]m_sum73,output reg dir73,reg [3:0]N73);
// 0 left 1 right
// dir assigned with 0 for Left shift and 1 for Right shift
always @(*) begin
casex(m_sum73)
12'b1xxxxxxxxxxx:
begin
dir73 = 1'b1;
N73 = 4'b0001;
end
12'b01xxxxxxxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0000;
end
12'b001xxxxxxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0001;
end
12'b0001xxxxxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0010;
end
12'b00001xxxxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0011;
end
12'b000001xxxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0100;
end
12'b0000001xxxxx:
begin
dir73 = 1'b0;
N73 = 4'b0101;
end
12'b00000001xxxx:
begin
dir73 = 1'b0;
N73 = 4'b0110;
end
12'b000000001xxx:
begin
dir73 = 1'b0;
N73 = 4'b0111;
end
12'b0000000001xx:
begin
dir73 = 1'b0;
N73 = 4'b1000;
end
12'b00000000001x:
begin
dir73 = 1'b0;
N73 = 4'b1001;
end
12'b000000000001:
begin
dir73 = 1'b0;
N73 = 4'b1010;
end
default:
begin
dir73 = 1'b0;
N73 = 4'b0;
end
endcase
end
endmodule