1 --+-------------------------------------------------------------------------------------------------+
 
   3 --|  File:              pcipargen.vhd                                                                                   |
 
   5 --|  Project:           pci32tlite_oc                                                                                                                                   |
 
   7 --|  Description:       PCI Parity Generator.                                                                                                                   |
 
   8 --|                                     PCI Target generates PAR in the data phase of a read cycle. The 1's sum on AD,  |
 
   9 --|                                     CBE and PAR is even.                                                                                    |
 
  11 --+-------------------------------------------------------------------------------------------------+
 
  13 --|  Revision history :                                                                                                                                                         |
 
  14 --|  Date                 Version       Author  Description                                                                                                             |
 
  15 --|  2005-05-13   R00A00        PAU             First alfa revision     (eng)                                                                           |
 
  19 --+-------------------------------------------------------------------------------------------------+
 
  20 --+-----------------------------------------------------------------+
 
  22 --|  Copyright (C) 2005 Peio Azkarate, peio@opencores.org               | 
 
  24 --|  This source file may be used and distributed without               |
 
  25 --|  restriction provided that this copyright statement is not          |
 
  26 --|  removed from the file and that any derivative work contains        |
 
  27 --|  the original copyright notice and the associated disclaimer.       |
 
  29 --|  This source file is free software; you can redistribute it     |
 
  30 --|  and/or modify it under the terms of the GNU Lesser General     |
 
  31 --|  Public License as published by the Free Software Foundation;   |
 
  32 --|  either version 2.1 of the License, or (at your option) any     |
 
  35 --|  This source is distributed in the hope that it will be         |
 
  36 --|  useful, but WITHOUT ANY WARRANTY; without even the implied     |
 
  37 --|  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        |
 
  38 --|  PURPOSE.  See the GNU Lesser General Public License for more   |
 
  41 --|  You should have received a copy of the GNU Lesser General      |
 
  42 --|  Public License along with this source; if not, download it     |
 
  43 --|  from http://www.opencores.org/lgpl.shtml                       |
 
  45 --+-----------------------------------------------------------------+ 
 
  48 --+-----------------------------------------------------------------------------+
 
  50 --+-----------------------------------------------------------------------------+
 
  53 use ieee.std_logic_1164.all;
 
  57 --+-----------------------------------------------------------------------------+
 
  59 --+-----------------------------------------------------------------------------+
 
  65         pcidatout_i             : in std_logic_vector(31 downto 0);
 
  66         cbe_i                   : in std_logic_vector(3 downto 0);
 
  67         parOE_i                 : in std_logic;
 
  74 architecture rtl of pcipargen is
 
  77 --+-----------------------------------------------------------------------------+
 
  79 --+-----------------------------------------------------------------------------+
 
  80 --+-----------------------------------------------------------------------------+
 
  82 --+-----------------------------------------------------------------------------+
 
  83 --+-----------------------------------------------------------------------------+
 
  85 --+-----------------------------------------------------------------------------+
 
  87         signal d                        : std_logic_vector(31 downto 0);
 
  88         signal pardat           : std_logic;
 
  89         signal parcbe           : std_logic;
 
  90         signal par                      : std_logic;
 
  91         signal par_s            : std_logic;
 
 115     --+-------------------------------------------------------------------------+
 
 116         --|  building parity                                                                                                            |
 
 117     --+-------------------------------------------------------------------------+
 
 119         pardat  <= d(0)  xor d(1)  xor d(2)  xor d(3)  xor d(4)  xor d(5)  xor d(6)  xor d(7)  xor 
 
 120                            d(8)  xor d(9)  xor d(10) xor d(11) xor d(12) xor d(13) xor d(14) xor d(15) xor 
 
 121                            d(16) xor d(17) xor d(18) xor d(19) xor d(20) xor d(21) xor d(22) xor d(23) xor 
 
 122                            d(24) xor d(25) xor d(26) xor d(27) xor d(28) xor d(29) xor d(30) xor d(31);
 
 124         parcbe  <= cbe_i(0) xor cbe_i(1) xor cbe_i(2) xor cbe_i(3); 
 
 126         par <= pardat xor parcbe;
 
 128     -- u1: sync port map ( clk => clk_i, d => par, q => par_s );
 
 137     --+-------------------------------------------------------------------------+
 
 139     --+-------------------------------------------------------------------------+
 
 141         par_o <= par_s when ( parOE_i = '1' ) else 'Z';