@@ -0,0 +1,150 | |||||
|
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 3 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 | -- Author : Martin Morlot | |||
|
20 | -- Mail : martin.morlot@lpp.polytechnique.fr | |||
|
21 | ------------------------------------------------------------------------------ | |||
|
22 | library ieee; | |||
|
23 | use ieee.std_logic_1164.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 | use lpp.apb_devices_list.all; | |||
|
31 | ||||
|
32 | ||||
|
33 | entity FFTDriver is | |||
|
34 | generic ( | |||
|
35 | pindex : integer := 0; | |||
|
36 | paddr : integer := 0; | |||
|
37 | pmask : integer := 16#fff#; | |||
|
38 | pirq : integer := 0; | |||
|
39 | abits : integer := 8; | |||
|
40 | LPP_DEVICE : integer; | |||
|
41 | Data_sz : integer := 16; | |||
|
42 | Addr_sz : integer := 8; | |||
|
43 | addr_max_int : integer := 256); | |||
|
44 | port ( | |||
|
45 | clk : in std_logic; --! Horloge du composant | |||
|
46 | rst : in std_logic; --! Reset general du composant | |||
|
47 | Rz : out std_logic; | |||
|
48 | ReadEnable : out std_logic; --! Instruction de lecture en m�moire | |||
|
49 | WriteEnable : out std_logic; --! Instruction d'�criture en m�moire | |||
|
50 | FlagEmpty : in std_logic; --! Flag, M�moire vide | |||
|
51 | FlagFull : in std_logic; --! Flag, M�moire pleine | |||
|
52 | DataIn : out std_logic_vector(Data_sz-1 downto 0); --! Registre de donn�es en entr�e | |||
|
53 | DataOut : in std_logic_vector(Data_sz-1 downto 0); --! Registre de donn�es en sortie | |||
|
54 | AddrIn : in std_logic_vector(Addr_sz-1 downto 0); --! Registre d'addresse (�criture) | |||
|
55 | AddrOut : in std_logic_vector(Addr_sz-1 downto 0); --! Registre d'addresse (lecture) | |||
|
56 | apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus | |||
|
57 | apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus | |||
|
58 | ); | |||
|
59 | end FFTDriver; | |||
|
60 | ||||
|
61 | architecture ar_FFTDriver of FFTDriver is | |||
|
62 | ||||
|
63 | constant REVISION : integer := 1; | |||
|
64 | ||||
|
65 | constant pconfig : apb_config_type := ( | |||
|
66 | 0 => ahb_device_reg (VENDOR_LPP, LPP_DEVICE, 0, REVISION, 0), | |||
|
67 | 1 => apb_iobar(paddr, pmask)); | |||
|
68 | ||||
|
69 | type DEVICE_ctrlr_Reg is record | |||
|
70 | DEVICE_Cfg : std_logic_vector(3 downto 0); | |||
|
71 | DEVICE_DataW : std_logic_vector(Data_sz-1 downto 0); | |||
|
72 | DEVICE_DataR : std_logic_vector(Data_sz-1 downto 0); | |||
|
73 | DEVICE_AddrW : std_logic_vector(Addr_sz-1 downto 0); | |||
|
74 | DEVICE_AddrR : std_logic_vector(Addr_sz-1 downto 0); | |||
|
75 | end record; | |||
|
76 | ||||
|
77 | signal Rec : DEVICE_ctrlr_Reg; | |||
|
78 | signal Rdata : std_logic_vector(31 downto 0); | |||
|
79 | ||||
|
80 | signal FlagWR : std_logic; | |||
|
81 | begin | |||
|
82 | ||||
|
83 | Rz <= Rec.DEVICE_Cfg(0); | |||
|
84 | ReadEnable <= Rec.DEVICE_Cfg(1); | |||
|
85 | Rec.DEVICE_Cfg(2) <= FlagEmpty; | |||
|
86 | Rec.DEVICE_Cfg(3) <= FlagFull; | |||
|
87 | ||||
|
88 | DataIn <= Rec.DEVICE_DataW; | |||
|
89 | Rec.DEVICE_DataR <= DataOut; | |||
|
90 | Rec.DEVICE_AddrW <= AddrIn; | |||
|
91 | Rec.DEVICE_AddrR <= AddrOut; | |||
|
92 | ||||
|
93 | ||||
|
94 | ||||
|
95 | process(rst,clk) | |||
|
96 | begin | |||
|
97 | if(rst='0')then | |||
|
98 | Rec.DEVICE_DataW <= (others => '0'); | |||
|
99 | Rec.DEVICE_Cfg(0) <= '0'; | |||
|
100 | Rec.DEVICE_Cfg(1) <= '0'; | |||
|
101 | FlagWR <= '0'; | |||
|
102 | ||||
|
103 | elsif(clk'event and clk='1')then | |||
|
104 | ||||
|
105 | --APB Write OP | |||
|
106 | if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then | |||
|
107 | case apbi.paddr(abits-1 downto 2) is | |||
|
108 | when "000000" => | |||
|
109 | FlagWR <= '1'; | |||
|
110 | Rec.DEVICE_DataW <= apbi.pwdata(Data_sz-1 downto 0); | |||
|
111 | When "000010" => | |||
|
112 | Rec.DEVICE_Cfg(0) <= apbi.pwdata(0); | |||
|
113 | Rec.DEVICE_Cfg(1) <= apbi.pwdata(4); | |||
|
114 | when others => | |||
|
115 | null; | |||
|
116 | end case; | |||
|
117 | else | |||
|
118 | FlagWR <= '0'; | |||
|
119 | end if; | |||
|
120 | ||||
|
121 | --APB Read OP | |||
|
122 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |||
|
123 | case apbi.paddr(abits-1 downto 2) is | |||
|
124 | when "000000" => | |||
|
125 | Rdata(Data_sz-1 downto 0) <= Rec.DEVICE_DataR; | |||
|
126 | when "000001" => | |||
|
127 | Rdata(31 downto 8) <= X"AAAAAA"; | |||
|
128 | Rdata(7 downto 0) <= Rec.DEVICE_AddrR; | |||
|
129 | when "000101" => | |||
|
130 | Rdata(31 downto 8) <= X"AAAAAA"; | |||
|
131 | Rdata(7 downto 0) <= Rec.DEVICE_AddrW; | |||
|
132 | when "000010" => | |||
|
133 | Rdata(3 downto 0) <= "000" & Rec.DEVICE_Cfg(0); | |||
|
134 | Rdata(7 downto 4) <= "000" & Rec.DEVICE_Cfg(1); | |||
|
135 | Rdata(11 downto 8) <= "000" & Rec.DEVICE_Cfg(2); | |||
|
136 | Rdata(15 downto 12) <= "000" & Rec.DEVICE_Cfg(3); | |||
|
137 | Rdata(31 downto 16) <= X"CCCC"; | |||
|
138 | when others => | |||
|
139 | Rdata <= (others => '0'); | |||
|
140 | end case; | |||
|
141 | end if; | |||
|
142 | ||||
|
143 | end if; | |||
|
144 | apbo.pconfig <= pconfig; | |||
|
145 | end process; | |||
|
146 | ||||
|
147 | apbo.prdata <= Rdata when apbi.penable = '1'; | |||
|
148 | WriteEnable <= FlagWR; | |||
|
149 | ||||
|
150 | end ar_FFTDriver; No newline at end of file |
@@ -41,12 +41,16 entity APB_FFT is | |||||
41 | pmask : integer := 16#fff#; |
|
41 | pmask : integer := 16#fff#; | |
42 | pirq : integer := 0; |
|
42 | pirq : integer := 0; | |
43 | abits : integer := 8; |
|
43 | abits : integer := 8; | |
44 |
Data_sz : integer := |
|
44 | Data_sz : integer := 32; | |
45 | Addr_sz : integer := 8; |
|
45 | Addr_sz : integer := 8; | |
46 | addr_max_int : integer := 256); |
|
46 | addr_max_int : integer := 256); | |
47 | port ( |
|
47 | port ( | |
48 | clk : in std_logic; --! Horloge du composant |
|
48 | clk : in std_logic; --! Horloge du composant | |
49 | rst : in std_logic; --! Reset general du composant |
|
49 | rst : in std_logic; --! Reset general du composant | |
|
50 | full,empty : out std_logic; | |||
|
51 | WR,RE : out std_logic; | |||
|
52 | flg_load,flg_rdy : out std_logic; | |||
|
53 | RZ : out std_logic; | |||
50 | apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus |
|
54 | apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus | |
51 | apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus |
|
55 | apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus | |
52 | ); |
|
56 | ); | |
@@ -55,31 +59,35 end APB_FFT; | |||||
55 |
|
59 | |||
56 | architecture ar_APB_FFT of APB_FFT is |
|
60 | architecture ar_APB_FFT of APB_FFT is | |
57 |
|
61 | |||
58 | signal ReadEnable : std_logic; |
|
62 | signal ReadEnable : std_logic; | |
59 | signal WriteEnable : std_logic; |
|
63 | signal WriteEnable : std_logic; | |
60 | signal FlagEmpty : std_logic; |
|
64 | signal FlagEmpty : std_logic; | |
61 | signal FlagFull : std_logic; |
|
65 | signal FlagFull : std_logic; | |
62 |
signal DataIn : std_logic_vector( |
|
66 | signal DataIn_re : std_logic_vector(gWSIZE-1 downto 0); | |
63 |
signal DataOut : std_logic_vector( |
|
67 | signal DataOut_re : std_logic_vector(gWSIZE-1 downto 0); | |
|
68 | signal DataIn_im : std_logic_vector(gWSIZE-1 downto 0); | |||
|
69 | signal DataOut_im : std_logic_vector(gWSIZE-1 downto 0); | |||
|
70 | signal DataIn : std_logic_vector(Data_sz-1 downto 0); | |||
|
71 | signal DataOut : std_logic_vector(Data_sz-1 downto 0); | |||
64 | signal AddrIn : std_logic_vector(Addr_sz-1 downto 0); |
|
72 | signal AddrIn : std_logic_vector(Addr_sz-1 downto 0); | |
65 | signal AddrOut : std_logic_vector(Addr_sz-1 downto 0); |
|
73 | signal AddrOut : std_logic_vector(Addr_sz-1 downto 0); | |
66 |
|
74 | |||
67 | signal start : std_logic; |
|
75 | signal start : std_logic; | |
68 | signal load : std_logic; |
|
76 | signal load : std_logic; | |
69 | signal rdy : std_logic; |
|
77 | signal rdy : std_logic; | |
70 | signal DummyIn : std_logic_vector(Data_sz-1 downto 0); |
|
78 | signal raz : std_logic; | |
71 |
|
79 | |||
72 |
|
80 | |||
73 | begin |
|
81 | begin | |
74 |
|
82 | |||
75 | APB : ApbDriver |
|
83 | APB : ApbDriver | |
76 | generic map(pindex,paddr,pmask,pirq,abits,LPP_FFT,Data_sz,Addr_sz,addr_max_int) |
|
84 | generic map(pindex,paddr,pmask,pirq,abits,LPP_FFT,Data_sz,Addr_sz,addr_max_int) | |
77 | port map(clk,rst,ReadEnable,WriteEnable,FlagEmpty,FlagFull,DataIn,DataOut,AddrIn,AddrOut,apbi,apbo); |
|
85 | port map(clk,rst,raz,ReadEnable,WriteEnable,FlagEmpty,FlagFull,DataIn,DataOut,AddrIn,AddrOut,apbi,apbo); | |
78 |
|
86 | |||
79 |
|
87 | |||
80 | Extremum : Flag_Extremum |
|
88 | Extremum : Flag_Extremum | |
81 |
port map(clk,raz,load,rdy, |
|
89 | port map(clk,raz,load,rdy,FlagFull,FlagEmpty); | |
82 |
|
90 | |||
83 |
|
91 | |||
84 | DEVICE : CoreFFT |
|
92 | DEVICE : CoreFFT | |
85 | generic map( |
|
93 | generic map( | |
@@ -94,11 +102,22 begin | |||||
94 | PTS => gPTS, |
|
102 | PTS => gPTS, | |
95 | HALFPTS => gHALFPTS, |
|
103 | HALFPTS => gHALFPTS, | |
96 | inBuf_RWDLY => gInBuf_RWDLY) |
|
104 | inBuf_RWDLY => gInBuf_RWDLY) | |
97 |
port map(clk,start,r |
|
105 | port map(clk,start,raz,WriteEnable,ReadEnable,DataIn_im,DataIn_re,load,open,DataOut_im,DataOut_re,open,rdy); | |
|
106 | ||||
|
107 | start <= not rst; | |||
|
108 | ||||
|
109 | DataIn_re <= DataIn(31 downto 16); | |||
|
110 | DataIn_im <= DataIn(15 downto 0); | |||
|
111 | DataOut <= DataOut_re & DataOut_im; | |||
|
112 | ||||
98 |
|
113 | |||
99 | start <= not rst; |
|
114 | full <= FlagFull; | |
100 | --FlagFull <= not load; |
|
115 | empty <= FlagEmpty; | |
101 | --FlagEmpty <= not rdy; |
|
116 | WR <= WriteEnable; | |
102 | DummyIn <= (others => '0'); |
|
117 | RE <= ReadEnable; | |
|
118 | flg_load <= load; | |||
|
119 | flg_rdy <= rdy; | |||
|
120 | RZ <= raz; | |||
|
121 | ||||
103 |
|
122 | |||
104 | end ar_APB_FFT; No newline at end of file |
|
123 | end ar_APB_FFT; |
@@ -29,8 +29,6 entity Flag_Extremum is | |||||
29 | clk,raz : in std_logic; |
|
29 | clk,raz : in std_logic; | |
30 | load : in std_logic; |
|
30 | load : in std_logic; | |
31 | y_rdy : in std_logic; |
|
31 | y_rdy : in std_logic; | |
32 | d_valid_WR : in std_logic; |
|
|||
33 | read_y_RE : in std_logic; |
|
|||
34 | full : out std_logic; |
|
32 | full : out std_logic; | |
35 | empty : out std_logic |
|
33 | empty : out std_logic | |
36 | ); |
|
34 | ); | |
@@ -38,82 +36,80 end Flag_Extremum; | |||||
38 |
|
36 | |||
39 | architecture ar_Flag_Extremum of Flag_Extremum is |
|
37 | architecture ar_Flag_Extremum of Flag_Extremum is | |
40 |
|
38 | |||
41 |
type etat is (eA,eB,eC,e |
|
39 | --type etat is (eA,eB,eC,e0,e1,e2); | |
42 | signal ect : etat; |
|
40 | --signal ect : etat; | |
43 |
|
41 | |||
44 | signal load_reg : std_logic; |
|
42 | signal load_reg : std_logic; | |
45 | signal y_rdy_reg : std_logic; |
|
43 | signal y_rdy_reg : std_logic; | |
46 | signal RE_reg : std_logic; |
|
|||
47 | signal WR_reg : std_logic; |
|
|||
48 |
|
44 | |||
49 | begin |
|
45 | begin | |
50 | process (clk,raz) |
|
46 | process (clk,raz) | |
51 | begin |
|
47 | begin | |
52 | if(raz='0')then |
|
48 | if(raz='0')then | |
53 |
full <= ' |
|
49 | full <= '1'; | |
54 | empty <= '1'; |
|
50 | empty <= '1'; | |
55 | ect <= eA; |
|
51 | -- ect <= eA; | |
56 |
|
52 | |||
57 | elsif(clk' event and clk='1')then |
|
53 | elsif(clk' event and clk='1')then | |
58 |
|
|
54 | -- load_reg <= load; | |
59 | y_rdy_reg <= y_rdy; |
|
55 | -- y_rdy_reg <= y_rdy; | |
60 | RE_reg <= read_y_RE; |
|
|||
61 | WR_reg <= d_valid_WR; |
|
|||
62 |
|
||||
63 | case ect is |
|
|||
64 |
|
56 | |||
65 | when eA => |
|
57 | if(load='1' and y_rdy='0')then | |
66 | if(WR_reg='0' and d_valid_WR='1')then |
|
58 | full <= '0'; | |
67 |
|
|
59 | empty <= '1'; | |
68 | ect <= eB; |
|
60 | ||
69 | end if; |
|
61 | elsif(y_rdy='1')then | |
70 |
|
|
62 | full <= '1'; | |
71 | when eB => |
|
63 | empty <= '0'; | |
72 | if(load_reg='1' and load='0')then |
|
64 | ||
73 | ect <= eC; |
|
65 | else | |
74 |
|
|
66 | full <= '1'; | |
75 |
|
67 | empty <= '1'; | ||
76 | when eC => |
|
68 | ||
77 | if(load_reg='1' and load='0')then |
|
69 | end if; | |
78 | full <= '1'; |
|
70 | ||
79 | ect <= eD; |
|
71 | -- case ect is | |
80 | end if; |
|
|||
81 |
|
72 | |||
82 |
when e |
|
73 | -- when eA => | |
83 |
|
|
74 | -- if(load_reg='0' and load='1')then | |
84 | full <= '0'; |
|
75 | -- full <= '0'; | |
85 |
ect <= e |
|
76 | -- ect <= eB; | |
86 |
|
|
77 | -- end if; | |
87 |
|
78 | -- | ||
88 |
when e |
|
79 | -- when eB => | |
89 | empty <= '1'; |
|
80 | -- if(load_reg='1' and load='0')then | |
90 |
|
|
81 | -- ect <= eC; | |
91 |
|
82 | -- end if; | ||
92 | when e0 => |
|
83 | -- | |
93 | if(WR_reg='0' and d_valid_WR='1')then |
|
84 | -- when eC => | |
94 | empty <= '0'; |
|
85 | -- if(load_reg='1' and load='0')then | |
95 |
|
|
86 | -- full <= '1'; | |
96 |
e |
|
87 | -- ect <= e0; | |
97 |
|
88 | -- end if; | ||
98 | when e1 => |
|
89 | ||
99 | if(load_reg='1' and load='0')then |
|
90 | --=================================================================================== | |
100 | full <= '1'; |
|
|||
101 | ect <= e2; |
|
|||
102 | end if; |
|
|||
103 |
|
91 | |||
104 |
when e |
|
92 | -- when e0 => | |
105 |
if( |
|
93 | -- if(load_reg='0' and load='1')then | |
106 |
full <= '0'; |
|
94 | -- full <= '0'; | |
107 |
|
|
95 | -- ect <= e1; | |
108 | end if; |
|
96 | -- end if; | |
109 |
|
97 | -- | ||
110 |
when e |
|
98 | -- when e1 => | |
111 |
if( |
|
99 | -- if(load_reg='1' and load='0')then | |
112 |
|
|
100 | -- full <= '1'; | |
113 |
e |
|
101 | -- empty <= '0'; | |
114 |
|
|
102 | -- ect <= e2; | |
115 |
|
103 | -- end if; | ||
116 |
|
|
104 | -- | |
|
105 | -- when e2 => | |||
|
106 | -- if(y_rdy_reg='1' and y_rdy='0')then | |||
|
107 | -- empty <= '1'; | |||
|
108 | -- ect <= e0; | |||
|
109 | -- end if; | |||
|
110 | -- | |||
|
111 | -- | |||
|
112 | -- end case; | |||
117 | end if; |
|
113 | end if; | |
118 | end process; |
|
114 | end process; | |
119 |
|
115 |
@@ -40,15 +40,19 component APB_FFT is | |||||
40 | paddr : integer := 0; |
|
40 | paddr : integer := 0; | |
41 | pmask : integer := 16#fff#; |
|
41 | pmask : integer := 16#fff#; | |
42 | pirq : integer := 0; |
|
42 | pirq : integer := 0; | |
43 | abits : integer := 8; |
|
43 | abits : integer := 8; | |
44 |
|
|
44 | Data_sz : integer := 32; | |
45 | Addr_sz : integer := 8; |
|
45 | Addr_sz : integer := 8; | |
46 |
|
|
46 | addr_max_int : integer := 256); | |
47 | port ( |
|
47 | port ( | |
48 | clk : in std_logic; |
|
48 | clk : in std_logic; --! Horloge du composant | |
49 | rst : in std_logic; |
|
49 | rst : in std_logic; --! Reset general du composant | |
50 | apbi : in apb_slv_in_type; |
|
50 | full,empty : out std_logic; | |
51 | apbo : out apb_slv_out_type |
|
51 | WR,RE : out std_logic; | |
|
52 | flg_load,flg_rdy : out std_logic; | |||
|
53 | RZ : out std_logic; | |||
|
54 | apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus | |||
|
55 | apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus | |||
52 | ); |
|
56 | ); | |
53 | end component; |
|
57 | end component; | |
54 |
|
58 | |||
@@ -58,8 +62,6 component Flag_Extremum is | |||||
58 | clk,raz : in std_logic; |
|
62 | clk,raz : in std_logic; | |
59 | load : in std_logic; |
|
63 | load : in std_logic; | |
60 | y_rdy : in std_logic; |
|
64 | y_rdy : in std_logic; | |
61 | d_valid_WR : in std_logic; |
|
|||
62 | read_y_RE : in std_logic; |
|
|||
63 | full : out std_logic; |
|
65 | full : out std_logic; | |
64 | empty : out std_logic |
|
66 | empty : out std_logic | |
65 | ); |
|
67 | ); |
@@ -45,6 +45,7 entity ApbDriver is | |||||
45 | port ( |
|
45 | port ( | |
46 | clk : in std_logic; --! Horloge du composant |
|
46 | clk : in std_logic; --! Horloge du composant | |
47 | rst : in std_logic; --! Reset general du composant |
|
47 | rst : in std_logic; --! Reset general du composant | |
|
48 | RZ : out std_logic; | |||
48 | ReadEnable : out std_logic; --! Instruction de lecture en m�moire |
|
49 | ReadEnable : out std_logic; --! Instruction de lecture en m�moire | |
49 | WriteEnable : out std_logic; --! Instruction d'�criture en m�moire |
|
50 | WriteEnable : out std_logic; --! Instruction d'�criture en m�moire | |
50 | FlagEmpty : in std_logic; --! Flag, M�moire vide |
|
51 | FlagEmpty : in std_logic; --! Flag, M�moire vide | |
@@ -69,7 +70,7 constant pconfig : apb_config_type := ( | |||||
69 | 1 => apb_iobar(paddr, pmask)); |
|
70 | 1 => apb_iobar(paddr, pmask)); | |
70 |
|
71 | |||
71 | type DEVICE_ctrlr_Reg is record |
|
72 | type DEVICE_ctrlr_Reg is record | |
72 |
DEVICE_Cfg : std_logic_vector( |
|
73 | DEVICE_Cfg : std_logic_vector(4 downto 0); | |
73 | DEVICE_DataW : std_logic_vector(Data_sz-1 downto 0); |
|
74 | DEVICE_DataW : std_logic_vector(Data_sz-1 downto 0); | |
74 | DEVICE_DataR : std_logic_vector(Data_sz-1 downto 0); |
|
75 | DEVICE_DataR : std_logic_vector(Data_sz-1 downto 0); | |
75 | DEVICE_AddrW : std_logic_vector(Addr_sz-1 downto 0); |
|
76 | DEVICE_AddrW : std_logic_vector(Addr_sz-1 downto 0); | |
@@ -87,6 +88,7 Rec.DEVICE_Cfg(0) <= FlagRE; | |||||
87 | Rec.DEVICE_Cfg(1) <= FlagWR; |
|
88 | Rec.DEVICE_Cfg(1) <= FlagWR; | |
88 | Rec.DEVICE_Cfg(2) <= FlagEmpty; |
|
89 | Rec.DEVICE_Cfg(2) <= FlagEmpty; | |
89 | Rec.DEVICE_Cfg(3) <= FlagFull; |
|
90 | Rec.DEVICE_Cfg(3) <= FlagFull; | |
|
91 | Rz <= Rec.DEVICE_Cfg(4); | |||
90 |
|
92 | |||
91 | DataIn <= Rec.DEVICE_DataW; |
|
93 | DataIn <= Rec.DEVICE_DataW; | |
92 | Rec.DEVICE_DataR <= DataOut; |
|
94 | Rec.DEVICE_DataR <= DataOut; | |
@@ -99,6 +101,7 Rec.DEVICE_AddrR <= AddrOut; | |||||
99 | begin |
|
101 | begin | |
100 | if(rst='0')then |
|
102 | if(rst='0')then | |
101 | Rec.DEVICE_DataW <= (others => '0'); |
|
103 | Rec.DEVICE_DataW <= (others => '0'); | |
|
104 | Rec.DEVICE_Cfg(4) <= '0'; | |||
102 | FlagWR <= '0'; |
|
105 | FlagWR <= '0'; | |
103 | FlagRE <= '0'; |
|
106 | FlagRE <= '0'; | |
104 |
|
107 | |||
@@ -109,7 +112,9 Rec.DEVICE_AddrR <= AddrOut; | |||||
109 | case apbi.paddr(abits-1 downto 2) is |
|
112 | case apbi.paddr(abits-1 downto 2) is | |
110 | when "000000" => |
|
113 | when "000000" => | |
111 | FlagWR <= '1'; |
|
114 | FlagWR <= '1'; | |
112 |
Rec.DEVICE_DataW <= apbi.pwdata(1 |
|
115 | Rec.DEVICE_DataW <= apbi.pwdata(Data_sz-1 downto 0); | |
|
116 | when "000010" => | |||
|
117 | Rec.DEVICE_Cfg(4) <= apbi.pwdata(16); | |||
113 | when others => |
|
118 | when others => | |
114 | null; |
|
119 | null; | |
115 | end case; |
|
120 | end case; | |
@@ -122,8 +127,7 Rec.DEVICE_AddrR <= AddrOut; | |||||
122 | case apbi.paddr(abits-1 downto 2) is |
|
127 | case apbi.paddr(abits-1 downto 2) is | |
123 | when "000000" => |
|
128 | when "000000" => | |
124 | FlagRE <= '1'; |
|
129 | FlagRE <= '1'; | |
125 |
Rdata( |
|
130 | Rdata(Data_sz-1 downto 0) <= Rec.DEVICE_DataR; | |
126 | Rdata(15 downto 0) <= Rec.DEVICE_DataR; |
|
|||
127 | when "000001" => |
|
131 | when "000001" => | |
128 | Rdata(31 downto 8) <= X"AAAAAA"; |
|
132 | Rdata(31 downto 8) <= X"AAAAAA"; | |
129 | Rdata(7 downto 0) <= Rec.DEVICE_AddrR; |
|
133 | Rdata(7 downto 0) <= Rec.DEVICE_AddrR; | |
@@ -135,7 +139,8 Rec.DEVICE_AddrR <= AddrOut; | |||||
135 | Rdata(7 downto 4) <= "000" & Rec.DEVICE_Cfg(1); |
|
139 | Rdata(7 downto 4) <= "000" & Rec.DEVICE_Cfg(1); | |
136 | Rdata(11 downto 8) <= "000" & Rec.DEVICE_Cfg(2); |
|
140 | Rdata(11 downto 8) <= "000" & Rec.DEVICE_Cfg(2); | |
137 | Rdata(15 downto 12) <= "000" & Rec.DEVICE_Cfg(3); |
|
141 | Rdata(15 downto 12) <= "000" & Rec.DEVICE_Cfg(3); | |
138 |
Rdata( |
|
142 | Rdata(19 downto 16) <= "000" & Rec.DEVICE_Cfg(4); | |
|
143 | Rdata(31 downto 20) <= X"CCC"; | |||
139 | when others => |
|
144 | when others => | |
140 | Rdata <= (others => '0'); |
|
145 | Rdata <= (others => '0'); | |
141 | end case; |
|
146 | end case; |
@@ -69,6 +69,7 component ApbDriver is | |||||
69 | port ( |
|
69 | port ( | |
70 | clk : in std_logic; |
|
70 | clk : in std_logic; | |
71 | rst : in std_logic; |
|
71 | rst : in std_logic; | |
|
72 | RZ : out std_logic; | |||
72 | ReadEnable : in std_logic; |
|
73 | ReadEnable : in std_logic; | |
73 | WriteEnable : in std_logic; |
|
74 | WriteEnable : in std_logic; | |
74 | FlagEmpty : in std_logic; |
|
75 | FlagEmpty : in std_logic; |
General Comments 0
You need to be logged in to leave comments.
Login now