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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [vlib/] [serport/] [serport_uart_rx.vhd] - Diff between revs 2 and 13

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 13
Line 1... Line 1...
-- $Id: serport_uart_rx.vhd 314 2010-07-09 17:38:41Z mueller $
-- $Id: serport_uart_rx.vhd 421 2011-11-07 21:23:50Z mueller $
--
--
-- Copyright 2007-2009 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2007-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
--
--
-- This program is free software; you may redistribute and/or modify it under
-- This program is free software; you may redistribute and/or modify it under
-- the terms of the GNU General Public License as published by the Free
-- the terms of the GNU General Public License as published by the Free
-- Software Foundation, either version 2, or at your option any later version.
-- Software Foundation, either version 2, or at your option any later version.
--
--
Line 22... Line 22...
-- Description:    serial port UART - receiver
-- Description:    serial port UART - receiver
--
--
-- Dependencies:   -
-- Dependencies:   -
-- Test bench:     tb/tb_serport_uart_rxtx
-- Test bench:     tb/tb_serport_uart_rxtx
-- Target Devices: generic
-- Target Devices: generic
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
-- Tool versions:  xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
-- Revision History: 
-- Revision History: 
-- Date         Rev Version  Comment
-- Date         Rev Version  Comment
 
-- 2011-10-22   417   2.0.3  now numeric_std clean
-- 2009-07-12   233   2.0.2  remove snoopers
-- 2009-07-12   233   2.0.2  remove snoopers
-- 2008-03-02   121   2.0.1  comment out snoopers
-- 2008-03-02   121   2.0.1  comment out snoopers
-- 2007-10-21    91   2.0    re-designed and -implemented with state machine.
-- 2007-10-21    91   2.0    re-designed and -implemented with state machine.
--                           allow CLKDIV=0 with 1 stop bit; allow max. CLKDIV
--                           allow CLKDIV=0 with 1 stop bit; allow max. CLKDIV
--                           (all 1's); aborts bad start bit after 1/2 cell;
--                           (all 1's); aborts bad start bit after 1/2 cell;
Line 41... Line 42...
-- 2007-06-30    62   1.0    Initial version 
-- 2007-06-30    62   1.0    Initial version 
------------------------------------------------------------------------------
------------------------------------------------------------------------------
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.numeric_std.all;
 
 
-- synthesis translate_off
 
use ieee.std_logic_textio.all;
 
use std.textio.all;
 
-- synthesis translate_on
 
 
 
use work.slvtypes.all;
use work.slvtypes.all;
 
 
entity serport_uart_rx is               -- serial port uart: receive part
entity serport_uart_rx is               -- serial port uart: receive part
  generic (
  generic (
Line 89... Line 85...
  end record regs_type;
  end record regs_type;
 
 
  constant ccntzero : slv(CDWIDTH-1 downto 0) := (others=>'0');
  constant ccntzero : slv(CDWIDTH-1 downto 0) := (others=>'0');
  constant dcntzero : slv(CDWIDTH   downto 0) := (others=>'0');
  constant dcntzero : slv(CDWIDTH   downto 0) := (others=>'0');
  constant regs_init : regs_type := (
  constant regs_init : regs_type := (
    s_idle,
    s_idle,                             -- state
    ccntzero,
    ccntzero,                           -- ccnt
    dcntzero,
    dcntzero,                           -- dcnt
    (others=>'0'),
    (others=>'0'),                      -- bcnt
    (others=>'0')
    (others=>'0')                       -- sreg
  );
  );
 
 
  signal R_REGS : regs_type := regs_init;  -- state registers
  signal R_REGS : regs_type := regs_init;  -- state registers
  signal N_REGS : regs_type := regs_init;  -- next value state regs
  signal N_REGS : regs_type := regs_init;  -- next value state regs
 
 
begin
begin
 
 
  proc_regs: process (CLK)
  proc_regs: process (CLK)
  begin
  begin
 
 
    if CLK'event and CLK='1' then
    if rising_edge(CLK) then
      R_REGS <= N_REGS;
      R_REGS <= N_REGS;
    end if;
    end if;
 
 
  end process proc_regs;
  end process proc_regs;
 
 
Line 278... Line 274...
    end if;
    end if;
 
 
    if ld_ccnt = '1' then               -- implement ccnt
    if ld_ccnt = '1' then               -- implement ccnt
      n.ccnt := CLKDIV;
      n.ccnt := CLKDIV;
    else
    else
      n.ccnt := unsigned(r.ccnt) - 1;
      n.ccnt := slv(unsigned(r.ccnt) - 1);
    end if;
    end if;
 
 
    if ld_dcnt = '1' then               -- implement dcnt
    if ld_dcnt = '1' then               -- implement dcnt
      n.dcnt(CDWIDTH downto 1) := (others=>'0');
      n.dcnt(CDWIDTH downto 1) := (others=>'0');
      n.dcnt(0) := RXSD;
      n.dcnt(0) := RXSD;
    else
    else
      if RXSD = '1' then
      if RXSD = '1' then
        n.dcnt := unsigned(r.dcnt) + 1;
        n.dcnt := slv(unsigned(r.dcnt) + 1);
      end if;
      end if;
    end if;
    end if;
 
 
    if ld_bcnt = '1' then               -- implement bcnt
    if ld_bcnt = '1' then               -- implement bcnt
      n.bcnt := (others=>'0');
      n.bcnt := (others=>'0');
    else
    else
      if ce_bcnt = '1' then
      if ce_bcnt = '1' then
        n.bcnt := unsigned(r.bcnt) + 1;
        n.bcnt := slv(unsigned(r.bcnt) + 1);
      end if;
      end if;
    end if;
    end if;
 
 
    N_REGS <= n;
    N_REGS <= n;
 
 

powered by: WebSVN 2.1.0

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