OpenCores
URL https://opencores.org/ocsvn/openhmc/openhmc/trunk

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [rtl/] [hmc_controller/] [rx/] [rx_lane_logic.v] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 11 juko
/*
2
 *                              .--------------. .----------------. .------------.
3
 *                             | .------------. | .--------------. | .----------. |
4
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
5
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
6
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
7
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
8
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
9
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
10
 *           | |               | |            | | |              | | |          | |
11
 *           |_|               | '------------' | '--------------' | '----------' |
12
 *                              '--------------' '----------------' '------------'
13
 *
14
 *  openHMC - An Open Source Hybrid Memory Cube Controller
15
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
16
 *  www.ziti.uni-heidelberg.de
17
 *  B6, 26
18
 *  68159 Mannheim
19
 *  Germany
20
 *
21
 *  Contact: openhmc@ziti.uni-heidelberg.de
22
 *  http://ra.ziti.uni-heidelberg.de/openhmc
23
 *
24
 *   This source file is free software: you can redistribute it and/or modify
25
 *   it under the terms of the GNU Lesser General Public License as published by
26
 *   the Free Software Foundation, either version 3 of the License, or
27
 *   (at your option) any later version.
28
 *
29
 *   This source file is distributed in the hope that it will be useful,
30
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 *   GNU Lesser General Public License for more details.
33
 *
34
 *   You should have received a copy of the GNU Lesser General Public License
35
 *   along with this source file.  If not, see <http://www.gnu.org/licenses/>.
36
 *
37
 *
38
 *  Module name: rx_lane_logic
39
 *
40
 */
41
 
42
`default_nettype none
43
 
44
module rx_lane_logic #(
45
    parameter DWIDTH             = 512,
46
    parameter NUM_LANES          = 8,
47
    parameter LANE_DWIDTH        = (DWIDTH/NUM_LANES),
48
    parameter CTRL_LANE_POLARITY = 1,
49
    parameter BITSLIP_SHIFT_RIGHT= 1
50
) (
51
 
52
    //----------------------------------
53
    //----SYSTEM INTERFACE
54
    //----------------------------------
55
    input   wire clk,
56
    input   wire res_n,
57
 
58
    //----------------------------------
59
    //----CONNECT
60
    //----------------------------------
61
    input   wire [LANE_DWIDTH-1:0]      scrambled_data_in,
62
    input   wire                        bit_slip,   //bit slip per lane
63
    input   wire                        lane_polarity,
64 15 juko
    input   wire                        can_lock,
65 11 juko
    output  wire [LANE_DWIDTH-1:0]      descrambled_data_out,
66
    output  wire                        descrambler_locked,
67
    input   wire                        descrambler_disable
68
 
69
);
70
 
71
wire    [LANE_DWIDTH-1:0]       descrambled_data_out_tmp;
72
wire    [LANE_DWIDTH-1:0]       data_2_descrambler;
73
wire                            descrambler_locked_tmp;
74 15 juko
assign descrambler_locked       = descrambler_disable ? can_lock : descrambler_locked_tmp;
75 11 juko
 
76
 
77
 
78
//=====================================================================================================
79
//-----------------------------------------------------------------------------------------------------
80
//---------ACTUAL LOGIC STARTS HERE--------------------------------------------------------------------
81
//-----------------------------------------------------------------------------------------------------
82
//=====================================================================================================
83
generate
84
    if(CTRL_LANE_POLARITY==1) begin
85
 
86
        reg [LANE_DWIDTH-1:0] scrambled_data_in_reg;
87
 
88
        `ifdef ASYNC_RES
89
        always @(posedge clk or negedge res_n)  begin `else
90
            always @(posedge clk)  begin `endif
91
 
92 15 juko
            `ifdef RESET_ALL
93 11 juko
            if(!res_n) begin
94
                scrambled_data_in_reg   <=  {LANE_DWIDTH{1'b0}};
95 15 juko
            end else
96
            `endif
97
            begin
98 11 juko
                scrambled_data_in_reg   <= scrambled_data_in^{LANE_DWIDTH{lane_polarity}};
99
            end
100
        end
101
 
102
        assign data_2_descrambler   = scrambled_data_in_reg;
103
        assign descrambled_data_out = descrambler_disable ? scrambled_data_in_reg : descrambled_data_out_tmp;
104
 
105
    end else begin
106
 
107
        assign data_2_descrambler   = scrambled_data_in;
108
        assign descrambled_data_out = descrambler_disable ? scrambled_data_in : descrambled_data_out_tmp;
109
 
110
    end
111
endgenerate
112
 
113
//=====================================================================================================
114
//-----------------------------------------------------------------------------------------------------
115
//---------INSTANTIATIONS HERE-------------------------------------------------------------------------
116
//-----------------------------------------------------------------------------------------------------
117
//=====================================================================================================
118
 
119
//Descrambler Init
120
    rx_descrambler #(
121
        .DWIDTH(LANE_DWIDTH),
122
        .BITSLIP_SHIFT_RIGHT(BITSLIP_SHIFT_RIGHT)
123
    ) descrambler_I (
124
        .clk(clk),
125
        .res_n(res_n),
126 15 juko
        .can_lock(can_lock),
127 11 juko
        .bit_slip(bit_slip),
128
        .locked(descrambler_locked_tmp),
129
        .data_in(data_2_descrambler),
130
        .data_out(descrambled_data_out_tmp)
131
    );
132
 
133
endmodule
134
`default_nettype wire

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.