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 234

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

Line No. Rev Author Line
1 213 jshamlet
-- Copyright (c)2011, 2019 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 213 jshamlet
-- Seth Henry      04/10/20 Code Cleanup
36 224 jshamlet
-- Seth Henry      04/16/20 Modified to make use of Open8 bus record
37 167 jshamlet
 
38
library ieee;
39
use ieee.std_logic_1164.all;
40
 
41
library work;
42
  use work.open8_pkg.all;
43
 
44
entity o8_gpin is
45
generic(
46 213 jshamlet
  Address                    : ADDRESS_TYPE
47 167 jshamlet
);
48
port(
49 223 jshamlet
  Open8_Bus                  : in  OPEN8_BUS_TYPE;
50 213 jshamlet
  Rd_Data                    : out DATA_TYPE;
51 167 jshamlet
  --
52 213 jshamlet
  GPIN                       : in  DATA_TYPE
53 167 jshamlet
);
54
end entity;
55
 
56
architecture behave of o8_gpin is
57 224 jshamlet
  alias Clock                is Open8_Bus.Clock;
58
  alias Reset                is Open8_Bus.Reset;
59 167 jshamlet
 
60 213 jshamlet
  constant User_Addr         : std_logic_vector(15 downto 0) := Address;
61 223 jshamlet
  alias  Comp_Addr           is Open8_Bus.Address(15 downto 0);
62 213 jshamlet
  signal Addr_Match          : std_logic;
63
  signal Rd_En               : std_logic;
64 191 jshamlet
 
65 213 jshamlet
  signal GPIN_q1             : DATA_TYPE;
66
  signal GPIN_q2             : DATA_TYPE;
67
  signal User_In             : DATA_TYPE;
68 167 jshamlet
 
69
begin
70
 
71 223 jshamlet
  Addr_Match                 <= Open8_Bus.Rd_En when Comp_Addr = User_Addr else
72
                                '0';
73 167 jshamlet
 
74
  io_reg: process( Clock, Reset )
75
  begin
76
    if( Reset = Reset_Level )then
77 213 jshamlet
      Rd_En                  <= '0';
78
      Rd_Data                <= OPEN8_NULLBUS;
79
      GPIN_q1                <= x"00";
80
      GPIN_q2                <= x"00";
81
      User_In                <= x"00";
82 167 jshamlet
    elsif( rising_edge( Clock ) )then
83 213 jshamlet
      GPIN_q1                <= GPIN;
84
      GPIN_q2                <= GPIN_q1;
85
      User_In                <= GPIN_q2;
86 167 jshamlet
 
87 213 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
88
      Rd_En                  <= Addr_Match;
89 167 jshamlet
      if( Rd_En = '1' )then
90 213 jshamlet
        Rd_Data              <= User_In;
91 167 jshamlet
      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.