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 236

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 217 jshamlet
  signal Addr_Match          : std_logic;
69
  signal Rd_En               : std_logic;
70 180 jshamlet
 
71 217 jshamlet
  signal Strobe_sr           : std_logic_vector(3 downto 0);
72
  signal Strobe_re           : std_logic;
73 180 jshamlet
 
74 217 jshamlet
  signal LData_q1            : DATA_TYPE;
75
  signal LData_q2            : DATA_TYPE;
76
  signal LData_q3            : DATA_TYPE;
77 180 jshamlet
 
78
begin
79
 
80 223 jshamlet
  Addr_Match                 <= Open8_Bus.Rd_En when Comp_Addr = User_Addr else '0';
81 217 jshamlet
  Strobe_re                  <= Strobe_sr(2) and not Strobe_sr(3);
82 180 jshamlet
 
83
  io_reg: process( Clock, Reset )
84
  begin
85
    if( Reset = Reset_Level )then
86 217 jshamlet
      Rd_En                  <= '0';
87
      Rd_Data                <= OPEN8_NULLBUS;
88
      Strobe_sr              <= (others => '0');
89
      Interrupt              <= '0';
90
      LData_q1               <= x"00";
91
      LData_q2               <= x"00";
92
      LData_q3               <= x"00";
93 180 jshamlet
    elsif( rising_edge( Clock ) )then
94 217 jshamlet
      Strobe_sr              <= Strobe_sr(2 downto 0) & L_Strobe;
95 180 jshamlet
 
96 217 jshamlet
      LData_q1               <= L_Data;
97
      LData_q2               <= LData_q1;
98
      Interrupt              <= Strobe_re;
99 180 jshamlet
      if( Strobe_re = '1' )then
100 217 jshamlet
        LData_q3             <= LData_q2;
101 180 jshamlet
      end if;
102
 
103 217 jshamlet
      Rd_Data                <= OPEN8_NULLBUS;
104
      Rd_En                  <= Addr_Match;
105 180 jshamlet
      if( Rd_En = '1' )then
106 217 jshamlet
        Rd_Data              <= LData_q3;
107 180 jshamlet
      end if;
108
    end if;
109
  end process;
110
 
111
end architecture;

powered by: WebSVN 2.1.0

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