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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_datalatch.vhd] - Blame information for rev 253

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 180 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 180 jshamlet
--
24
-- VHDL Units :  o8_datalatch
25
-- Description:  Latches a byte of external data and issues an interrupt on
26
--                capture.
27
--
28
--
29
-- Register Map:
30
-- Offset  Bitfield Description                        Read/Write
31
--   0x00  AAAAAAAA Latched Value                      (RW)
32
--
33
-- Note: Cut the path between LData_q1 and L_Data for timing analysis
34
--
35
-- Revision History
36
-- Author          Date     Change
37
------------------ -------- ---------------------------------------------------
38
-- Seth Henry      01/22/20 Design Start
39 224 jshamlet
-- Seth Henry      04/16/20 Modified to use Open8 bus record
40 180 jshamlet
 
41
library ieee;
42
use ieee.std_logic_1164.all;
43
 
44
library work;
45
  use work.open8_pkg.all;
46
 
47
entity o8_datalatch is
48
generic(
49 217 jshamlet
  Address                    : ADDRESS_TYPE
50 180 jshamlet
);
51
port(
52 223 jshamlet
  Open8_Bus                  : in  OPEN8_BUS_TYPE;
53 217 jshamlet
  Rd_Data                    : out DATA_TYPE;
54
  Interrupt                  : out std_logic;
55 180 jshamlet
  --
56 217 jshamlet
  L_Strobe                   : in  std_logic;
57
  L_Data                     : in  DATA_TYPE
58 180 jshamlet
);
59
end entity;
60
 
61
architecture behave of o8_datalatch is
62
 
63 224 jshamlet
  alias Clock                is Open8_Bus.Clock;
64
  alias Reset                is Open8_Bus.Reset;
65
 
66 217 jshamlet
  constant User_Addr         : std_logic_vector(15 downto 0) := Address;
67 223 jshamlet
  alias  Comp_Addr           is Open8_Bus.Address(15 downto 0);
68 244 jshamlet
  signal Addr_Match          : std_logic := '0';
69 180 jshamlet
 
70 244 jshamlet
  signal Rd_En_d             : std_logic := '0';
71
  signal Rd_En_q             : std_logic := '0';
72 180 jshamlet
 
73 244 jshamlet
  signal Strobe_sr           : std_logic_vector(3 downto 0) := "0000";
74
  signal Strobe_re           : std_logic := '0';
75 180 jshamlet
 
76 244 jshamlet
  signal LData_q1            : DATA_TYPE := x"00";
77
  signal LData_q2            : DATA_TYPE := x"00";
78
  signal LData_q3            : DATA_TYPE := x"00";
79
 
80 180 jshamlet
begin
81
 
82 223 jshamlet
  Addr_Match                 <= Open8_Bus.Rd_En when Comp_Addr = User_Addr else '0';
83 217 jshamlet
  Strobe_re                  <= Strobe_sr(2) and not Strobe_sr(3);
84 180 jshamlet
 
85
  io_reg: process( Clock, Reset )
86
  begin
87
    if( Reset = Reset_Level )then
88 244 jshamlet
      Rd_En_q                <= '0';
89 217 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
90
      Strobe_sr              <= (others => '0');
91
      Interrupt              <= '0';
92
      LData_q1               <= x"00";
93
      LData_q2               <= x"00";
94
      LData_q3               <= x"00";
95 180 jshamlet
    elsif( rising_edge( Clock ) )then
96 217 jshamlet
      Strobe_sr              <= Strobe_sr(2 downto 0) & L_Strobe;
97 180 jshamlet
 
98 217 jshamlet
      LData_q1               <= L_Data;
99
      LData_q2               <= LData_q1;
100
      Interrupt              <= Strobe_re;
101 180 jshamlet
      if( Strobe_re = '1' )then
102 217 jshamlet
        LData_q3             <= LData_q2;
103 180 jshamlet
      end if;
104
 
105 217 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
106 244 jshamlet
      Rd_En_q                <= Rd_En_d;
107
      if( Rd_En_q = '1' )then
108 217 jshamlet
        Rd_Data              <= LData_q3;
109 180 jshamlet
      end if;
110
    end if;
111
  end process;
112
 
113
end architecture;

powered by: WebSVN 2.1.0

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