-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHermitian_Mapping.v
96 lines (93 loc) · 2.8 KB
/
Hermitian_Mapping.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// =============================================================================
// Filename: HermitianMapping.v
// Author: KANG, Jian
// Email: jkangac@connect.ust.hk
// Affiliation: Hong Kong University of Science and Technology
// Description: Mapping the signal from one path to two. one of output is the original signaland the other path is the hermitian
// -----------------------------------------------------------------------------
`timescale 1 ns / 1 ps
module HermitianMapping(
input CLK,
input RST,
input [27:0] DATA_IN_RE,
input [27:0] DATA_IN_IM,
input [15:0] DATA_IN_INDEX,
input DATA_IN_VALID,
output reg [27:0] DATA_OUT_RE,
output reg [27:0] DATA_OUT_IM,
output reg [15:0] DATA_OUT_INDEX,
output reg DATA_OUT_VALID,
output reg [27:0] DATA_OUT_RE_HER,
output reg [27:0] DATA_OUT_IM_HER,
output reg [15:0] DATA_OUT_INDEX_HER,
output reg DATA_OUT_VALID_HER
);
wire [27:0] data_im_neg_temp;
Negetive Negetive_inst(
.ori_data(DATA_IN_IM),
.neg_data(data_im_neg_temp)
);
always @ (posedge CLK)
begin
if(RST)
begin
DATA_OUT_IM <= 28'd0;
DATA_OUT_RE <= 28'd0;
DATA_OUT_INDEX <= 16'd0;
DATA_OUT_VALID <= 1'b0;
DATA_OUT_IM_HER <= 28'd0;
DATA_OUT_RE_HER <= 28'd0;
DATA_OUT_INDEX_HER <= 16'd0;
DATA_OUT_VALID_HER <= 1'b0;
end
else
begin
if(DATA_IN_VALID)
begin
DATA_OUT_VALID <= DATA_IN_VALID;
DATA_OUT_INDEX <= DATA_IN_INDEX; //the 0~4 subcarrier carry nothing.
DATA_OUT_RE <= DATA_IN_RE;
DATA_OUT_IM <= DATA_IN_IM;
DATA_OUT_VALID_HER <= DATA_IN_VALID;
DATA_OUT_INDEX_HER <= DATA_IN_INDEX;
DATA_OUT_RE_HER <= DATA_IN_RE;
DATA_OUT_IM_HER <= data_im_neg_temp;
end
else
begin
DATA_OUT_IM <= 28'd0;
DATA_OUT_RE <= 28'd0;
DATA_OUT_INDEX <= 16'd0;
DATA_OUT_VALID <= 1'b0;
DATA_OUT_IM_HER <= 28'd0;
DATA_OUT_RE_HER <= 28'd0;
DATA_OUT_INDEX_HER <= 16'd0;
DATA_OUT_VALID_HER <= 1'b0;
end
end
end
endmodule
//this is the sub module used to get the negetive number
module Negetive(
input [27:0] ori_data,
output reg [27:0] neg_data
);
always@(*)
begin
if (ori_data == 0)
begin
neg_data <= 28'd0;
end
else
begin
if (ori_data[27] == 1)
begin
neg_data <= {1'b0,~(ori_data[26:0] - 1'b1)};
end
else
begin
neg_data <= {1'b1,~ori_data[26:0] + 1'b1};
end
end
end
endmodule