OpenCores
URL https://opencores.org/ocsvn/mkjpeg/mkjpeg/trunk

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [tb/] [vhdl/] [JPEG_TB.VHD] - Blame information for rev 35

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 mikel262
--------------------------------------------------------------------------------
2
--                                                                            --
3
--                          V H D L    F I L E                                --
4
--                          COPYRIGHT (C) 2006                                --
5
--                                                                            --
6
--------------------------------------------------------------------------------
7
--
8
-- Title       : JPEG_TB
9
-- Design      : JPEG_ENC
10
-- Author      : Michal Krepa
11
--
12
--------------------------------------------------------------------------------
13
--
14
-- File        : JPEG_TB.VHD
15
-- Created     : Sun Mar 1 2009
16
--
17
--------------------------------------------------------------------------------
18
--
19
--  Description : Testbench top-level
20
--
21
--------------------------------------------------------------------------------
22
 
23
library IEEE;
24
  use IEEE.STD_LOGIC_1164.all;
25
  use ieee.numeric_std.all;
26
  use IEEE.STD_LOGIC_TEXTIO.ALL;
27
 
28
library STD;
29
  use STD.TEXTIO.ALL;
30
 
31
library work;
32
  use work.GPL_V2_Image_Pkg.ALL;
33
  use WORK.MDCT_PKG.all;
34
  use WORK.MDCTTB_PKG.all;
35
 
36
entity JPEG_TB is
37
end JPEG_TB;
38
 
39
--**************************************************************************--
40
 
41
architecture TB of JPEG_TB is
42
 
43
  type char_file is file of character;
44
 
45
  file f_capture           : text;
46
  file f_capture_bin       : char_file;
47
  constant CAPTURE_ORAM    : string := "OUT_RAM.txt";
48
  constant CAPTURE_BIN     : string := "test_out.jpg";
49
 
50
  signal CLK               : STD_LOGIC;
51
  signal RST               : STD_LOGIC;
52
 
53
  signal ram_rdaddr        : std_logic_vector(23 downto 0);
54
  signal ram_q             : std_logic_vector(7 downto 0);
55
  signal ram_byte          : std_logic_vector(7 downto 0);
56
  signal ram_wren          : std_logic;
57
  signal ram_wraddr        : std_logic_vector(23 downto 0);
58
 
59
  signal OPB_ABus          : std_logic_vector(31 downto 0);
60
  signal OPB_BE            : std_logic_vector(3 downto 0);
61
  signal OPB_DBus_in       : std_logic_vector(31 downto 0);
62
  signal OPB_RNW           : std_logic;
63
  signal OPB_select        : std_logic;
64
  signal OPB_DBus_out      : std_logic_vector(31 downto 0);
65
  signal OPB_XferAck       : std_logic;
66
  signal OPB_retry         : std_logic;
67
  signal OPB_toutSup       : std_logic;
68
  signal OPB_errAck        : std_logic;
69
  signal iram_waddr        : std_logic_vector(19 downto 0);
70
  signal iram_raddr        : std_logic_vector(19 downto 0);
71
  signal iram_wdata        : std_logic_vector(23 downto 0);
72
  signal iram_rdata        : std_logic_vector(23 downto 0);
73
  signal iram_wren         : std_logic;
74
  signal iram_rden         : std_logic;
75
  signal sim_done          : std_logic;
76
  signal iram_fifo_afull   : std_logic;
77
 
78
------------------------------
79
-- architecture begin
80
------------------------------
81
begin
82
 
83
 
84
 
85
 
86
  ------------------------------
87
  -- CLKGEN map
88
  ------------------------------
89
  U_ClkGen : entity work.ClkGen
90
        port map
91
  (
92
     CLK            => CLK,
93
     RST            => RST
94
        );
95
 
96
  ------------------------------
97
  -- HOST Bus Functional Model
98
  ------------------------------
99
  U_HostBFM : entity work.HostBFM
100
  port map
101
  (
102
        CLK            => CLK,
103
        RST            => RST,
104
        -- OPB
105
        OPB_ABus       => OPB_ABus,
106
        OPB_BE         => OPB_BE,
107
        OPB_DBus_in    => OPB_DBus_in,
108
        OPB_RNW        => OPB_RNW,
109
        OPB_select     => OPB_select,
110
        OPB_DBus_out   => OPB_DBus_out,
111
        OPB_XferAck    => OPB_XferAck,
112
        OPB_retry      => OPB_retry,
113
        OPB_toutSup    => OPB_toutSup,
114
        OPB_errAck     => OPB_errAck,
115
 
116
        -- IRAM
117
        iram_wdata     => iram_wdata,
118
        iram_wren      => iram_wren,
119
        fifo_almost_full => iram_fifo_afull,
120
 
121
        sim_done       => sim_done
122
    );
123
 
124
  ------------------------------
125
  -- JPEG ENCODER
126
  ------------------------------
127
  U_JpegEnc : entity work.JpegEnc
128
  port map
129
  (
130
        CLK                => CLK,
131
        RST                => RST,
132
 
133
        -- OPB
134
        OPB_ABus           => OPB_ABus,
135
        OPB_BE             => OPB_BE,
136
        OPB_DBus_in        => OPB_DBus_in,
137
        OPB_RNW            => OPB_RNW,
138
        OPB_select         => OPB_select,
139
        OPB_DBus_out       => OPB_DBus_out,
140
        OPB_XferAck        => OPB_XferAck,
141
        OPB_retry          => OPB_retry,
142
        OPB_toutSup        => OPB_toutSup,
143
        OPB_errAck         => OPB_errAck,
144
 
145
        -- IMAGE RAM
146
        iram_wdata         => iram_wdata,
147
        iram_wren          => iram_wren,
148
        iram_fifo_afull    => iram_fifo_afull,
149
 
150
        -- OUT RAM
151
        ram_byte           => ram_byte,
152
        ram_wren           => ram_wren,
153
        ram_wraddr         => ram_wraddr
154
    );
155
 
156
  -------------------------------------------------------------------
157
  -- OUT RAM
158
  -------------------------------------------------------------------
159
  U_OUT_RAM : entity work.RAMSIM
160
  generic map
161
  (
162
      RAMADDR_W     => 18,
163
      RAMDATA_W     => 8
164
  )
165
  port map
166
  (
167
        d           => ram_byte,
168
        waddr       => ram_wraddr(17 downto 0),
169
        raddr       => ram_rdaddr(17 downto 0),
170
        we          => ram_wren,
171
        clk         => CLK,
172
 
173
        q           => ram_q
174
  );
175
 
176
 
177
  p_capture : process
178
    variable fLine           : line;
179
    variable fLine_bin       : line;
180
  begin
181
    file_open(f_capture, CAPTURE_ORAM, write_mode);
182
    file_open(f_capture_bin, CAPTURE_BIN, write_mode);
183
 
184
    while sim_done /= '1' loop
185
      wait until rising_edge(CLK);
186
 
187
      if ram_wren = '1' then
188
        hwrite(fLine, ram_byte);
189
        write(fLine, string'(" "));
190
 
191
        write(f_capture_bin, CHARACTER'VAL(to_integer(unsigned(ram_byte))));
192
 
193
      end if;
194
 
195
    end loop;
196
    writeline(f_capture, fLine);
197
    --writeline(f_capture_bin, fLine_bin);
198
 
199
    file_close(f_capture);
200
    file_close(f_capture_bin);
201
 
202
    wait;
203
  end process;
204
 
205
 
206
end TB;
207
-----------------------------------
208
 
209
 
210
--**************************************************************************--

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.