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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_gpin.vhd] - Blame information for rev 167

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

Line No. Rev Author Line
1 167 jshamlet
-- Copyright (c)2013 Jeremy Seth Henry
2
-- All rights reserved.
3
--
4
-- Redistribution and use in source and binary forms, with or without
5
-- modification, are permitted provided that the following conditions are met:
6
--     * Redistributions of source code must retain the above copyright
7
--       notice, this list of conditions and the following disclaimer.
8
--     * Redistributions in binary form must reproduce the above copyright
9
--       notice, this list of conditions and the following disclaimer in the
10
--       documentation and/or other materials provided with the distribution,
11
--       where applicable (as part of a user interface, debugging port, etc.)
12
--
13
-- THIS SOFTWARE IS PROVIDED BY JEREMY SETH HENRY ``AS IS'' AND ANY
14
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
17
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
--
24
-- VHDL Units :  o8_gpin
25
-- Description:  Provides a single 8-bit input register
26
 
27
library ieee;
28
use ieee.std_logic_1164.all;
29
 
30
library work;
31
  use work.open8_pkg.all;
32
 
33
entity o8_gpin is
34
generic(
35
  Reset_Level           : std_logic;
36
  Address               : ADDRESS_TYPE
37
);
38
port(
39
  Clock                 : in  std_logic;
40
  Reset                 : in  std_logic;
41
  --
42
  Bus_Address           : in  ADDRESS_TYPE;
43
  Rd_Enable             : in  std_logic;
44
  Rd_Data               : out DATA_TYPE;
45
  --
46
  GPIN                  : in  DATA_TYPE
47
);
48
end entity;
49
 
50
architecture behave of o8_gpin is
51
 
52
  constant User_Addr    : std_logic_vector(15 downto 0) := Address;
53
  alias  Comp_Addr      is Bus_Address(15 downto 0);
54
  signal Addr_Match     : std_logic;
55
  signal Rd_En          : std_logic;
56
  signal User_In        : DATA_TYPE;
57
 
58
begin
59
 
60
  Addr_Match            <= Rd_Enable when Comp_Addr = User_Addr else '0';
61
 
62
  io_reg: process( Clock, Reset )
63
  begin
64
    if( Reset = Reset_Level )then
65
      Rd_En             <= '0';
66
      Rd_Data           <= x"00";
67
    elsif( rising_edge( Clock ) )then
68
      User_In           <= GPIN; -- first stage of double buffer
69
 
70
      Rd_Data           <= (others => '0');
71
      Rd_En             <= Addr_Match;
72
      if( Rd_En = '1' )then
73
        Rd_Data         <= User_In;
74
      end if;
75
    end if;
76
  end process;
77
 
78
end architecture;

powered by: WebSVN 2.1.0

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