@@ -0,0 +1,106 | |||
|
1 | ------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | ------------------------------------------------------------------------------- | |
|
19 | -- APB_MULTI_DIODE.vhd | |
|
20 | ||
|
21 | library ieee; | |
|
22 | use ieee.std_logic_1164.all; | |
|
23 | --use ieee.numeric_std.all; | |
|
24 | library grlib; | |
|
25 | use grlib.amba.all; | |
|
26 | use grlib.stdlib.all; | |
|
27 | use grlib.devices.all; | |
|
28 | library lpp; | |
|
29 | use lpp.lpp_amba.all; | |
|
30 | ||
|
31 | ||
|
32 | entity APB_MULTI_DIODE is | |
|
33 | generic ( | |
|
34 | pindex : integer := 0; | |
|
35 | paddr : integer := 0; | |
|
36 | pmask : integer := 16#fff#; | |
|
37 | pirq : integer := 0; | |
|
38 | abits : integer := 8); | |
|
39 | port ( | |
|
40 | rst : in std_ulogic; | |
|
41 | clk : in std_ulogic; | |
|
42 | apbi : in apb_slv_in_type; | |
|
43 | apbo : out apb_slv_out_type; | |
|
44 | LED : out std_logic_vector(2 downto 0) | |
|
45 | ); | |
|
46 | end; | |
|
47 | ||
|
48 | ||
|
49 | architecture AR_APB_MULTI_DIODE of APB_MULTI_DIODE is | |
|
50 | ||
|
51 | constant REVISION : integer := 1; | |
|
52 | ||
|
53 | constant pconfig : apb_config_type := ( | |
|
54 | 0 => ahb_device_reg (VENDOR_LPP, LPP_MULTI_DIODE, 0, REVISION, 0), | |
|
55 | 1 => apb_iobar(paddr, pmask)); | |
|
56 | ||
|
57 | ||
|
58 | ||
|
59 | type LEDregs is record | |
|
60 | DATAin : std_logic_vector(31 downto 0); | |
|
61 | DATAout : std_logic_vector(31 downto 0); | |
|
62 | end record; | |
|
63 | ||
|
64 | signal r : LEDregs; | |
|
65 | ||
|
66 | ||
|
67 | begin | |
|
68 | ||
|
69 | r.DATAout <= r.DATAin xor X"FFFFFFFF"; | |
|
70 | ||
|
71 | process(rst,clk) | |
|
72 | begin | |
|
73 | if rst = '0' then | |
|
74 | LED <= "000"; | |
|
75 | r.DATAin <= (others => '0'); | |
|
76 | apbo.prdata <= (others => '0'); | |
|
77 | elsif clk'event and clk = '1' then | |
|
78 | ||
|
79 | LED <= r.DATAin(2 downto 0); | |
|
80 | ||
|
81 | --APB Write OP | |
|
82 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |
|
83 | case apbi.paddr(abits-1 downto 2) is | |
|
84 | when "000000" => | |
|
85 | r.DATAin <= apbi.pwdata; | |
|
86 | when others => | |
|
87 | null; | |
|
88 | end case; | |
|
89 | end if; | |
|
90 | ||
|
91 | --APB READ OP | |
|
92 | if (apbi.psel(pindex) and apbi.penable and (not apbi.pwrite)) = '1' then | |
|
93 | case apbi.paddr(abits-1 downto 2) is | |
|
94 | when "000000" => | |
|
95 | apbo.prdata <= r.DATAin; | |
|
96 | when others => | |
|
97 | apbo.prdata <= r.DATAout; | |
|
98 | end case; | |
|
99 | end if; | |
|
100 | ||
|
101 | end if; | |
|
102 | apbo.pconfig <= pconfig; | |
|
103 | end process; | |
|
104 | ||
|
105 | ||
|
106 | end ar_APB_MULTI_DIODE; No newline at end of file |
@@ -24,9 +24,7 use grlib.amba.all; | |||
|
24 | 24 | -- pragma translate_off |
|
25 | 25 | use std.textio.all; |
|
26 | 26 | -- pragma translate_on |
|
27 | ||
|
28 | ||
|
29 | ||
|
27 | ||
|
30 | 28 |
|
|
31 | 29 |
|
|
32 | 30 | package lpp_amba is |
@@ -38,6 +36,7 constant VENDOR_LPP : amba_vendor | |||
|
38 | 36 | constant ROCKET_TM : amba_device_type := 16#001#; |
|
39 | 37 | constant otherCore : amba_device_type := 16#002#; |
|
40 | 38 | constant LPP_SIMPLE_DIODE : amba_device_type := 16#003#; |
|
39 | constant LPP_MULTI_DIODE : amba_device_type := 16#004#; | |
|
41 | 40 | |
|
42 | 41 | |
|
43 | 42 | component APB_SIMPLE_DIODE is |
@@ -57,4 +56,20 component APB_SIMPLE_DIODE is | |||
|
57 | 56 | end component; |
|
58 | 57 | |
|
59 | 58 | |
|
59 | component APB_MULTI_DIODE is | |
|
60 | generic ( | |
|
61 | pindex : integer := 0; | |
|
62 | paddr : integer := 0; | |
|
63 | pmask : integer := 16#fff#; | |
|
64 | pirq : integer := 0; | |
|
65 | abits : integer := 8); | |
|
66 | port ( | |
|
67 | rst : in std_ulogic; | |
|
68 | clk : in std_ulogic; | |
|
69 | apbi : in apb_slv_in_type; | |
|
70 | apbo : out apb_slv_out_type; | |
|
71 | LED : out std_logic_vector(2 downto 0) | |
|
72 | ); | |
|
73 | end component; | |
|
74 | ||
|
60 | 75 | end; |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now