OpenCores
URL https://opencores.org/ocsvn/systemverilog-uart16550/systemverilog-uart16550/trunk

Subversion Repositories systemverilog-uart16550

[/] [systemverilog-uart16550/] [trunk/] [rtl/] [uart_noize_shaver.sv] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 hiroshi
/* *****************************************************************************
2
   * title:         uart_16550_rll module                                      *
3
   * description:   RS232 Protocol 16550D uart (mostly supported)              *
4
   * languages:     systemVerilog                                              *
5
   *                                                                           *
6
   * Copyright (C) 2010 miyagi.hiroshi                                         *
7
   *                                                                           *
8
   * This library is free software; you can redistribute it and/or             *
9
   * modify it under the terms of the GNU Lesser General Public                *
10
   * License as published by the Free Software Foundation; either              *
11
   * version 2.1 of the License, or (at your option) any later version.        *
12
   *                                                                           *
13
   * This library is distributed in the hope that it will be useful,           *
14
   * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
15
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
16
   * Lesser General Public License for more details.                           *
17
   *                                                                           *
18
   * You should have received a copy of the GNU Lesser General Public          *
19
   * License along with this library; if not, write to the Free Software       *
20
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111*1307  USA *
21
   *                                                                           *
22
   *         ***  GNU LESSER GENERAL PUBLIC LICENSE  ***                       *
23
   *           from http://www.gnu.org/licenses/lgpl.txt                       *
24
   *****************************************************************************
25
   *                            redleaflogic,ltd                               *
26
   *                    miyagi.hiroshi@redleaflogic.biz                        *
27
   *          $Id: uart_noize_shaver.sv 108 2010-03-30 02:56:26Z hiroshi $         *
28
   ***************************************************************************** */
29
 
30
`ifdef SYN
31
/* empty */
32
`else
33
timeunit      1ps ;
34
timeprecision 1ps ;
35
`endif
36
 
37
module uart_noize_shaver
38
  (
39
   input wire clk_i,
40
   input wire nrst_i,
41
   input wire rxd_i,
42
   output rxd_clean
43
   ) ;
44
   // -- receiver baud --
45
   logic [3:0] count ;
46
   logic [3:0] shift ;
47
 
48
   always_ff @(posedge clk_i, negedge nrst_i) begin
49
      if(nrst_i == 1'b0)
50
        count <= #1 0 ;
51
      else
52
        count <= #1 count + 4'h1 ;
53
   end
54
 
55
   always_ff @(posedge clk_i, negedge nrst_i) begin
56
      if(nrst_i == 1'b0)
57
        shift <= #1 4'b1111 ;
58
      else if(count == 4'h0)
59
        shift <= #1 {shift[2:0], rxd_i} ;
60
      else
61
        shift <= #1 shift ;
62
   end
63
 
64
   assign rxd_clean = shift == 4'hf ||
65
                      shift == 4'he ||
66
                      shift == 4'hd ||
67
                      shift == 4'hb ||
68
                      shift == 4'h7 ;
69
endmodule

powered by: WebSVN 2.1.0

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