1 |
10 |
peio |
--+-------------------------------------------------------------------------------------------------+
|
2 |
|
|
--| |
|
3 |
|
|
--| File: pcipargen.vhd |
|
4 |
|
|
--| |
|
5 |
|
|
--| Project: pci32tLite |
|
6 |
|
|
--| |
|
7 |
|
|
--| Description: PCI Parity Generator. |
|
8 |
|
|
--| |
|
9 |
|
|
--+-------------------------------------------------------------------------------------------------+
|
10 |
|
|
--+-----------------------------------------------------------------+
|
11 |
|
|
--| |
|
12 |
|
|
--| Copyright (C) 2005-2008 Peio Azkarate, peio.azkarate@gmail.com |
|
13 |
|
|
--| |
|
14 |
|
|
--| This source file may be used and distributed without |
|
15 |
|
|
--| restriction provided that this copyright statement is not |
|
16 |
|
|
--| removed from the file and that any derivative work contains |
|
17 |
|
|
--| the original copyright notice and the associated disclaimer. |
|
18 |
|
|
--| |
|
19 |
|
|
--| This source file is free software; you can redistribute it |
|
20 |
|
|
--| and/or modify it under the terms of the GNU Lesser General |
|
21 |
|
|
--| Public License as published by the Free Software Foundation; |
|
22 |
|
|
--| either version 2.1 of the License, or (at your option) any |
|
23 |
|
|
--| later version. |
|
24 |
|
|
--| |
|
25 |
|
|
--| This source is distributed in the hope that it will be |
|
26 |
|
|
--| useful, but WITHOUT ANY WARRANTY; without even the implied |
|
27 |
|
|
--| warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
28 |
|
|
--| PURPOSE. See the GNU Lesser General Public License for more |
|
29 |
|
|
--| details. |
|
30 |
|
|
--| |
|
31 |
|
|
--| You should have received a copy of the GNU Lesser General |
|
32 |
|
|
--| Public License along with this source; if not, download it |
|
33 |
|
|
--| from http://www.opencores.org/lgpl.shtml |
|
34 |
|
|
--| |
|
35 |
|
|
--+-----------------------------------------------------------------+
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
--+-----------------------------------------------------------------------------+
|
39 |
|
|
--| LIBRARIES |
|
40 |
|
|
--+-----------------------------------------------------------------------------+
|
41 |
|
|
|
42 |
|
|
library ieee;
|
43 |
|
|
use ieee.std_logic_1164.all;
|
44 |
|
|
|
45 |
|
|
library onalib;
|
46 |
|
|
use onalib.onapackage.all;
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
--+-----------------------------------------------------------------------------+
|
50 |
|
|
--| ENTITY |
|
51 |
|
|
--+-----------------------------------------------------------------------------+
|
52 |
|
|
|
53 |
|
|
entity pcipargen is
|
54 |
|
|
port (
|
55 |
|
|
|
56 |
|
|
clk_i : in std_logic;
|
57 |
|
|
pcidatout_i : in std_logic_vector(31 downto 0);
|
58 |
|
|
cbe_i : in std_logic_vector(3 downto 0);
|
59 |
|
|
parOE_i : in std_logic;
|
60 |
|
|
par_o : out std_logic
|
61 |
|
|
|
62 |
|
|
);
|
63 |
|
|
end pcipargen;
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
architecture rtl of pcipargen is
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
--+-----------------------------------------------------------------------------+
|
70 |
|
|
--| COMPONENTS |
|
71 |
|
|
--+-----------------------------------------------------------------------------+
|
72 |
|
|
--+-----------------------------------------------------------------------------+
|
73 |
|
|
--| CONSTANTS |
|
74 |
|
|
--+-----------------------------------------------------------------------------+
|
75 |
|
|
--+-----------------------------------------------------------------------------+
|
76 |
|
|
--| SIGNALS |
|
77 |
|
|
--+-----------------------------------------------------------------------------+
|
78 |
|
|
|
79 |
|
|
signal d : std_logic_vector(31 downto 0);
|
80 |
|
|
signal pardat : std_logic;
|
81 |
|
|
signal parcbe : std_logic;
|
82 |
|
|
signal par : std_logic;
|
83 |
|
|
signal par_s : std_logic;
|
84 |
|
|
|
85 |
|
|
begin
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
d <= pcidatout_i;
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
--+-------------------------------------------------------------------------+
|
92 |
|
|
--| building parity |
|
93 |
|
|
--+-------------------------------------------------------------------------+
|
94 |
|
|
|
95 |
|
|
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
|
96 |
|
|
d(8) xor d(9) xor d(10) xor d(11) xor d(12) xor d(13) xor d(14) xor d(15) xor
|
97 |
|
|
d(16) xor d(17) xor d(18) xor d(19) xor d(20) xor d(21) xor d(22) xor d(23) xor
|
98 |
|
|
d(24) xor d(25) xor d(26) xor d(27) xor d(28) xor d(29) xor d(30) xor d(31);
|
99 |
|
|
|
100 |
|
|
parcbe <= cbe_i(0) xor cbe_i(1) xor cbe_i(2) xor cbe_i(3);
|
101 |
|
|
|
102 |
|
|
par <= pardat xor parcbe;
|
103 |
|
|
|
104 |
|
|
u1: sync port map ( clk => clk_i, d => par, q => par_s );
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
--+-------------------------------------------------------------------------+
|
108 |
|
|
--| PAR |
|
109 |
|
|
--+-------------------------------------------------------------------------+
|
110 |
|
|
|
111 |
|
|
par_o <= par_s when ( parOE_i = '1' ) else 'Z';
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
end rtl;
|