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 |
|
|
|
60 |
|
|
entity WB_OPRT_32 is
|
61 |
|
|
port(
|
62 |
|
|
-- WISHBONE SLAVE interface:
|
63 |
|
|
ACK_O : out std_logic;
|
64 |
|
|
CLK_I : in std_logic;
|
65 |
|
|
DAT_I : in std_logic_vector( 31 downto 0 );
|
66 |
|
|
DAT_O : out std_logic_vector( 31 downto 0 );
|
67 |
|
|
RST_I : in std_logic;
|
68 |
|
|
SEL_I : in std_logic_vector( 3 downto 0 );
|
69 |
|
|
STB_I : in std_logic;
|
70 |
|
|
WE_I : in std_logic;
|
71 |
|
|
-- Output port (non-WISHBONE signals):
|
72 |
|
|
PRT_O : out std_logic_vector( 31 downto 0 )
|
73 |
|
|
);
|
74 |
|
|
end entity WB_OPRT_32;
|
75 |
|
|
|
76 |
|
|
architecture rtl of WB_OPRT_32 is
|
77 |
|
|
signal QH: std_logic_vector( 7 downto 0 );
|
78 |
|
|
signal QMH: std_logic_vector( 7 downto 0 );
|
79 |
|
|
signal QML: std_logic_vector( 7 downto 0 );
|
80 |
|
|
signal QL: std_logic_vector( 7 downto 0 );
|
81 |
|
|
begin
|
82 |
|
|
|
83 |
|
|
REG: process( CLK_I )
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
if( rising_edge( CLK_I ) ) then
|
87 |
|
|
if( RST_I = '1' ) then
|
88 |
|
|
QH <= (others => '0');
|
89 |
|
|
elsif( STB_I = '1' and WE_I = '1' and SEL_I(3) = '1' ) then
|
90 |
|
|
QH <= DAT_I( 31 downto 24 );
|
91 |
|
|
end if;
|
92 |
|
|
end if;
|
93 |
|
|
|
94 |
|
|
if( rising_edge( CLK_I ) ) then
|
95 |
|
|
if( RST_I = '1' ) then
|
96 |
|
|
QMH <= (others => '0');
|
97 |
|
|
elsif( STB_I = '1' and WE_I = '1' and SEL_I(2) = '1' ) then
|
98 |
|
|
QMH <= DAT_I( 23 downto 16 );
|
99 |
|
|
end if;
|
100 |
|
|
end if;
|
101 |
|
|
|
102 |
|
|
if( rising_edge( CLK_I ) ) then
|
103 |
|
|
if( RST_I = '1' ) then
|
104 |
|
|
QML <= (others => '0');
|
105 |
|
|
elsif( STB_I = '1' and WE_I = '1' and SEL_I(1) = '1' ) then
|
106 |
|
|
QML <= DAT_I( 15 downto 8 );
|
107 |
|
|
end if;
|
108 |
|
|
end if;
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
if( rising_edge( CLK_I ) ) then
|
112 |
|
|
if( RST_I = '1' ) then
|
113 |
|
|
QL <= (others => '0');
|
114 |
|
|
elsif( STB_I = '1' and WE_I = '1' and SEL_I(0) = '1' ) then
|
115 |
|
|
QL <= DAT_I( 7 downto 0 );
|
116 |
|
|
end if;
|
117 |
|
|
end if;
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
end process REG;
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
ACK_O <= STB_I;
|
124 |
|
|
|
125 |
|
|
DAT_O( 31 downto 24 ) <= QH;
|
126 |
|
|
DAT_O( 23 downto 16 ) <= QMH;
|
127 |
|
|
DAT_O( 15 downto 8 ) <= QML;
|
128 |
|
|
DAT_O( 7 downto 0 ) <= QL;
|
129 |
|
|
|
130 |
|
|
PRT_O( 31 downto 24 ) <= QH;
|
131 |
|
|
PRT_O( 23 downto 16 ) <= QMH;
|
132 |
|
|
PRT_O( 15 downto 8 ) <= QML;
|
133 |
|
|
PRT_O( 7 downto 0 ) <= QL;
|
134 |
|
|
|
135 |
|
|
end architecture rtl;
|