1 |
25 |
mikel262 |
-------------------------------------------------------------------------------
|
2 |
|
|
-- File Name : OutMux.vhd
|
3 |
|
|
--
|
4 |
|
|
-- Project : JPEG_ENC
|
5 |
|
|
--
|
6 |
|
|
-- Module : OutMux
|
7 |
|
|
--
|
8 |
|
|
-- Content : Output Multiplexer
|
9 |
|
|
--
|
10 |
|
|
-- Description :
|
11 |
|
|
--
|
12 |
|
|
-- Spec. :
|
13 |
|
|
--
|
14 |
|
|
-- Author : Michal Krepa
|
15 |
|
|
--
|
16 |
|
|
-------------------------------------------------------------------------------
|
17 |
|
|
-- History :
|
18 |
|
|
-- 20090308: (MK): Initial Creation.
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
|
|
|
21 |
|
|
-------------------------------------------------------------------------------
|
22 |
|
|
-------------------------------------------------------------------------------
|
23 |
|
|
----------------------------------- LIBRARY/PACKAGE ---------------------------
|
24 |
|
|
-------------------------------------------------------------------------------
|
25 |
|
|
-------------------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
-------------------------------------------------------------------------------
|
28 |
|
|
-- generic packages/libraries:
|
29 |
|
|
-------------------------------------------------------------------------------
|
30 |
|
|
library ieee;
|
31 |
|
|
use ieee.std_logic_1164.all;
|
32 |
|
|
use ieee.numeric_std.all;
|
33 |
|
|
|
34 |
|
|
-------------------------------------------------------------------------------
|
35 |
|
|
-- user packages/libraries:
|
36 |
|
|
-------------------------------------------------------------------------------
|
37 |
|
|
library work;
|
38 |
|
|
use work.JPEG_PKG.all;
|
39 |
|
|
|
40 |
|
|
-------------------------------------------------------------------------------
|
41 |
|
|
-------------------------------------------------------------------------------
|
42 |
|
|
----------------------------------- ENTITY ------------------------------------
|
43 |
|
|
-------------------------------------------------------------------------------
|
44 |
|
|
-------------------------------------------------------------------------------
|
45 |
|
|
entity OutMux is
|
46 |
|
|
port
|
47 |
|
|
(
|
48 |
|
|
CLK : in std_logic;
|
49 |
|
|
RST : in std_logic;
|
50 |
|
|
-- CTRL
|
51 |
|
|
out_mux_ctrl : in std_logic;
|
52 |
|
|
|
53 |
|
|
-- ByteStuffer
|
54 |
|
|
bs_ram_byte : in std_logic_vector(7 downto 0);
|
55 |
|
|
bs_ram_wren : in std_logic;
|
56 |
|
|
bs_ram_wraddr : in std_logic_vector(23 downto 0);
|
57 |
|
|
|
58 |
|
|
-- JFIFGen
|
59 |
|
|
jfif_ram_byte : in std_logic_vector(7 downto 0);
|
60 |
|
|
jfif_ram_wren : in std_logic;
|
61 |
|
|
jfif_ram_wraddr : in std_logic_vector(23 downto 0);
|
62 |
|
|
|
63 |
|
|
-- OUT RAM
|
64 |
|
|
ram_byte : out std_logic_vector(7 downto 0);
|
65 |
|
|
ram_wren : out std_logic;
|
66 |
|
|
ram_wraddr : out std_logic_vector(23 downto 0)
|
67 |
|
|
);
|
68 |
|
|
end entity OutMux;
|
69 |
|
|
|
70 |
|
|
-------------------------------------------------------------------------------
|
71 |
|
|
-------------------------------------------------------------------------------
|
72 |
|
|
----------------------------------- ARCHITECTURE ------------------------------
|
73 |
|
|
-------------------------------------------------------------------------------
|
74 |
|
|
-------------------------------------------------------------------------------
|
75 |
|
|
architecture RTL of OutMux is
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
-------------------------------------------------------------------------------
|
80 |
|
|
-- Architecture: begin
|
81 |
|
|
-------------------------------------------------------------------------------
|
82 |
|
|
begin
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
-------------------------------------------------------------------
|
86 |
|
|
-- Mux
|
87 |
|
|
-------------------------------------------------------------------
|
88 |
|
|
p_ctrl : process(CLK, RST)
|
89 |
|
|
begin
|
90 |
|
|
if RST = '1' then
|
91 |
|
|
ram_byte <= (others => '0');
|
92 |
|
|
ram_wren <= '0';
|
93 |
|
|
ram_wraddr <= (others => '0');
|
94 |
|
|
elsif CLK'event and CLK = '1' then
|
95 |
|
|
if out_mux_ctrl = '0' then
|
96 |
|
|
ram_byte <= jfif_ram_byte;
|
97 |
|
|
ram_wren <= jfif_ram_wren;
|
98 |
|
|
ram_wraddr <= std_logic_vector(jfif_ram_wraddr);
|
99 |
|
|
else
|
100 |
|
|
ram_byte <= bs_ram_byte;
|
101 |
|
|
ram_wren <= bs_ram_wren;
|
102 |
|
|
ram_wraddr <= bs_ram_wraddr;
|
103 |
|
|
end if;
|
104 |
|
|
end if;
|
105 |
|
|
end process;
|
106 |
|
|
|
107 |
|
|
end architecture RTL;
|
108 |
|
|
-------------------------------------------------------------------------------
|
109 |
|
|
-- Architecture: end
|
110 |
|
|
-------------------------------------------------------------------------------
|