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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [rxepreambl.v] - Blame information for rev 49

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    rxepreambl.v
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     To detect, and then remove, any ethernet hardware preamble.
8
//
9
// Creator:     Dan Gisselquist, Ph.D.
10
//              Gisselquist Technology, LLC
11
//
12
////////////////////////////////////////////////////////////////////////////////
13
//
14
// Copyright (C) 2016, Gisselquist Technology, LLC
15
//
16
// This program is free software (firmware): you can redistribute it and/or
17
// modify it under the terms of  the GNU General Public License as published
18
// by the Free Software Foundation, either version 3 of the License, or (at
19
// your option) any later version.
20
//
21
// This program is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License along
27
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
28
// target there if the PDF file isn't present.)  If not, see
29
// <http://www.gnu.org/licenses/> for a copy.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
module  rxepreambl(i_clk, i_ce, i_en, i_cancel, i_v, i_d, o_v, o_d);
39
        input                   i_clk, i_ce, i_en, i_cancel;
40
        input                   i_v;
41
        input           [3:0]    i_d;
42
        output  reg             o_v;
43
        output  reg     [3:0]    o_d;
44
 
45
        reg     r_inpkt, r_cancel;
46
        reg     [14:0]   r_buf;
47
 
48
        always @(posedge i_clk)
49
        if(i_ce)
50
        begin
51
                if (((!i_v)&&(!o_v))||(i_cancel))
52
                begin
53
                        // Set us up
54
                        r_inpkt <= 1'b0;
55
                        r_cancel <= (i_v)||(o_v);
56
                end else if (r_cancel)
57
                        r_cancel <= (i_v)||(o_v);
58
 
59
                if ((i_en)&&(!r_inpkt))
60
                begin
61
                        r_buf <= { r_buf[9:0], i_v, i_d };
62
                        r_inpkt <= (!r_cancel)&&((r_buf == { 5'h15, 5'h15, 5'h15 })&&(i_v)&&(i_d == 4'hd));
63
                        o_v <= 1'b0;
64
                end else begin
65
                        o_v <= (i_v)&&(!r_cancel)&&(r_inpkt);
66
                        o_d <= i_d;
67
                end
68
        end
69
endmodule
70
 

powered by: WebSVN 2.1.0

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