1 |
6 |
amulcock |
--------------------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- WISHBONE wishbone out port from b3 spec IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the wishbone out port from b3 spec project ----
|
6 |
|
|
---- http://www.opencores.org/cores/wishbone_out_port ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- Implementation of the wishbone out port from b3 spec IP core ----
|
10 |
|
|
---- according to wishbone out port from b3 spec IP core specification ----
|
11 |
|
|
---- document. ----
|
12 |
|
|
---- ----
|
13 |
|
|
---- To Do: ----
|
14 |
|
|
---- NA ----
|
15 |
|
|
---- ----
|
16 |
|
|
---- Taken directly from the wishbone out port from b3 spec, appendix A ----
|
17 |
|
|
---- Changes made, 'tidy up', I like things in lines ----
|
18 |
|
|
---- change name, as Xilinx tools ( 9.2 sp 4 ) do not like ----
|
19 |
|
|
---- entity same name as the file name. ----
|
20 |
|
|
---- Used others clause for sync reset. ----
|
21 |
|
|
---- ----
|
22 |
|
|
---- Author(s): ----
|
23 |
|
|
---- Andrew Mulcock, amulcock@opencores.org ----
|
24 |
|
|
---- ----
|
25 |
|
|
--------------------------------------------------------------------------------
|
26 |
|
|
---- ----
|
27 |
|
|
---- Copyright (C) 2008 Authors and OPENCORES.ORG ----
|
28 |
|
|
---- ----
|
29 |
|
|
---- This source file may be used and distributed without ----
|
30 |
|
|
---- restriction provided that this copyright statement is not ----
|
31 |
|
|
---- removed from the file and that any derivative work contains ----
|
32 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
33 |
|
|
---- ----
|
34 |
|
|
---- This source file is free software; you can redistribute it ----
|
35 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
36 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
37 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
38 |
|
|
---- later version. ----
|
39 |
|
|
---- ----
|
40 |
|
|
---- This source is distributed in the hope that it will be ----
|
41 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
42 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
43 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
44 |
|
|
---- details. ----
|
45 |
|
|
---- ----
|
46 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
47 |
|
|
---- Public License along with this source; if not, download it ----
|
48 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
49 |
|
|
---- ----
|
50 |
|
|
--------------------------------------------------------------------------------
|
51 |
|
|
---- ----
|
52 |
|
|
-- CVS Revision History ----
|
53 |
|
|
---- ----
|
54 |
|
|
-- $Log: not supported by cvs2svn $ ----
|
55 |
|
|
---- ----
|
56 |
|
|
|
57 |
|
|
library ieee;
|
58 |
|
|
use ieee.std_logic_1164.all;
|
59 |
|
|
use ieee.numeric_std.all;
|
60 |
|
|
|
61 |
|
|
entity WB_MEM_32X16 is
|
62 |
|
|
port(
|
63 |
|
|
-- WISHBONE SLAVE interface:
|
64 |
|
|
-- Single-Port RAM with Asynchronous Read
|
65 |
|
|
--
|
66 |
|
|
ACK_O : out std_logic;
|
67 |
|
|
ADR_I : in std_logic_vector( 3 downto 0 );
|
68 |
|
|
CLK_I : in std_logic;
|
69 |
|
|
DAT_I : in std_logic_vector( 31 downto 0 );
|
70 |
|
|
DAT_O : out std_logic_vector( 31 downto 0 );
|
71 |
|
|
STB_I : in std_logic;
|
72 |
|
|
WE_I : in std_logic
|
73 |
|
|
);
|
74 |
|
|
end entity WB_MEM_32X16;
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
architecture rtl of WB_MEM_32X16 is
|
78 |
|
|
|
79 |
|
|
type ram_type is array (15 downto 0) of std_logic_vector (31 downto 0);
|
80 |
|
|
signal RAM : ram_type;
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
begin
|
84 |
|
|
|
85 |
|
|
REG: process( CLK_I )
|
86 |
|
|
begin
|
87 |
|
|
if( rising_edge( CLK_I ) ) then
|
88 |
|
|
if( (STB_I and WE_I) = '1' ) then
|
89 |
|
|
RAM(to_integer(unsigned(ADR_I))) <= DAT_I;
|
90 |
|
|
end if;
|
91 |
|
|
end if;
|
92 |
|
|
end process REG;
|
93 |
|
|
|
94 |
|
|
ACK_O <= STB_I;
|
95 |
|
|
|
96 |
|
|
DAT_O <= RAM(to_integer(unsigned(ADR_I)));
|
97 |
|
|
|
98 |
|
|
end architecture rtl;
|