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

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [examples/] [usb-fpga-1.15/] [1.15a/] [mmio/] [fpga/] [ucecho.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ZTEX
library ieee;
2
use IEEE.std_logic_1164.all;
3
use IEEE.std_logic_arith.all;
4
use IEEE.std_logic_unsigned.all;
5
--#use IEEE.numeric_std.all;
6
 
7
 
8
entity ucecho is
9
   port(
10
      FXCLK     : in std_logic;
11
      MM_A      : in std_logic_vector(15 downto 0);
12
      MM_D      : inout std_logic_vector(7 downto 0);
13
      MM_WRN    : in std_logic;
14
      MM_RDN    : in std_logic;
15
      MM_PSENN  : in std_logic
16
   );
17
end ucecho;
18
 
19
architecture RTL of ucecho is
20
 
21
--signal declaration
22
signal rd : std_logic := '1';
23
signal rd_prev : std_logic := '1';
24
signal wr : std_logic := '1';
25
signal wr_prev : std_logic := '1';
26
 
27
signal datain : std_logic_vector(7 downto 0);
28
signal dataout : std_logic_vector(7 downto 0);
29
 
30
begin
31
    rd <= MM_RDN and MM_PSENN;
32
    wr <= MM_WRN;
33
 
34
    MM_D <= dataout when ((rd_prev or rd) = '0') else ( others => 'Z' ); -- enable output
35
 
36
    dpUCECHO: process(FXCLK)
37
    begin
38
         if FXCLK' event and FXCLK = '1' then
39
            if (wr_prev = '1') and (wr = '0')                    -- EZ-USB write strobe
40
            then
41
                if MM_A = conv_std_logic_vector(16#5001#,16)    -- read data from EZ-USB if addr=0x5001
42
                then
43
                    datain <= MM_D;
44
                end if;
45
            elsif (rd_prev = '1') and (rd = '0')         -- EZ-USB read strobe
46
            then
47
                if MM_A = conv_std_logic_vector(16#5002#,16)    -- write data to EZ-USB if addr=0x5002
48
                then
49
                    if ( datain >= conv_std_logic_vector(97,8) ) and ( datain <= conv_std_logic_vector(122,8) ) -- do the upercase conversion
50
                    then
51
                        dataout <= datain - conv_std_logic_vector(32,8);
52
                    else
53
                        dataout <= datain ;
54
                    end if;
55
                end if;
56
            end if;
57
 
58
            rd_prev <= rd;
59
            wr_prev <= wr;
60
        end if;
61
    end process dpUCECHO;
62
 
63
end RTL;

powered by: WebSVN 2.1.0

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