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 207

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

Line No. Rev Author Line
1 194 jshamlet
-- Copyright (c)2006, 2016, 2019, 2020 Jeremy Seth Henry
2 167 jshamlet
-- 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 194 jshamlet
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 167 jshamlet
--
24
-- VHDL Units :  o8_gpin
25
-- Description:  Provides a single 8-bit input register
26 189 jshamlet
--
27
-- Note: Cut the path between GPIN and GPIN_q1 for timing analysis
28
--
29
-- Revision History
30
-- Author          Date     Change
31
------------------ -------- ---------------------------------------------------
32
-- Seth Henry      07/28/11 Design Start
33
-- Seth Henry      12/19/19 Renamed to "o8_gpin" to fit "theme"
34
-- Seth Henry      12/20/19 Added metastability registers
35 167 jshamlet
 
36
library ieee;
37
use ieee.std_logic_1164.all;
38
 
39
library work;
40
  use work.open8_pkg.all;
41
 
42
entity o8_gpin is
43
generic(
44
  Reset_Level           : std_logic;
45
  Address               : ADDRESS_TYPE
46
);
47
port(
48
  Clock                 : in  std_logic;
49
  Reset                 : in  std_logic;
50
  --
51
  Bus_Address           : in  ADDRESS_TYPE;
52
  Rd_Enable             : in  std_logic;
53
  Rd_Data               : out DATA_TYPE;
54
  --
55
  GPIN                  : in  DATA_TYPE
56
);
57
end entity;
58
 
59
architecture behave of o8_gpin is
60
 
61
  constant User_Addr    : std_logic_vector(15 downto 0) := Address;
62
  alias  Comp_Addr      is Bus_Address(15 downto 0);
63
  signal Addr_Match     : std_logic;
64
  signal Rd_En          : std_logic;
65 191 jshamlet
 
66 189 jshamlet
  signal GPIN_q1        : DATA_TYPE;
67
  signal GPIN_q2        : DATA_TYPE;
68 167 jshamlet
  signal User_In        : DATA_TYPE;
69
 
70
begin
71
 
72
  Addr_Match            <= Rd_Enable when Comp_Addr = User_Addr else '0';
73
 
74
  io_reg: process( Clock, Reset )
75
  begin
76
    if( Reset = Reset_Level )then
77
      Rd_En             <= '0';
78 191 jshamlet
      Rd_Data           <= OPEN8_NULLBUS;
79 189 jshamlet
      GPIN_q1           <= x"00";
80
      GPIN_q2           <= x"00";
81
      User_In           <= x"00";
82 167 jshamlet
    elsif( rising_edge( Clock ) )then
83 189 jshamlet
      GPIN_q1           <= GPIN;
84
      GPIN_q2           <= GPIN_q1;
85
      User_In           <= GPIN_q2;
86 167 jshamlet
 
87 191 jshamlet
      Rd_Data           <= OPEN8_NULLBUS;
88 167 jshamlet
      Rd_En             <= Addr_Match;
89
      if( Rd_En = '1' )then
90
        Rd_Data         <= User_In;
91
      end if;
92
    end if;
93
  end process;
94
 
95
end architecture;

powered by: WebSVN 2.1.0

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