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 320

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 191 jshamlet
 
64 244 jshamlet
  signal Rd_En_d             : std_logic := '0';
65
  signal Rd_En_q             : std_logic := '0';
66
 
67 213 jshamlet
  signal GPIN_q1             : DATA_TYPE;
68
  signal GPIN_q2             : DATA_TYPE;
69
  signal User_In             : DATA_TYPE;
70 167 jshamlet
 
71
begin
72
 
73 244 jshamlet
  Addr_Match                 <= '1' when Comp_Addr = User_Addr else '0';
74
  Rd_En_d                    <= Addr_Match and Open8_Bus.Rd_En;
75 167 jshamlet
 
76
  io_reg: process( Clock, Reset )
77
  begin
78
    if( Reset = Reset_Level )then
79 244 jshamlet
      Rd_En_q                <= '0';
80 213 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
81
      GPIN_q1                <= x"00";
82
      GPIN_q2                <= x"00";
83
      User_In                <= x"00";
84 167 jshamlet
    elsif( rising_edge( Clock ) )then
85 213 jshamlet
      GPIN_q1                <= GPIN;
86
      GPIN_q2                <= GPIN_q1;
87
      User_In                <= GPIN_q2;
88 167 jshamlet
 
89 213 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
90 244 jshamlet
      Rd_En_q                <= Rd_En_d;
91
      if( Rd_En_q = '1' )then
92 213 jshamlet
        Rd_Data              <= User_In;
93 167 jshamlet
      end if;
94
    end if;
95
  end process;
96
 
97
end architecture;

powered by: WebSVN 2.1.0

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