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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_version.vhd] - Blame information for rev 307

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

Line No. Rev Author Line
1 270 jshamlet
-- Copyright (c)2020 Jeremy Seth Henry
2
-- 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
-- (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
--
24
-- VHDL Units :  o8_version
25 307 jshamlet
-- Description:  Provides 2 read-only values, which are set at compile time
26 270 jshamlet
--
27
-- Register Map:
28
-- Offset  Bitfield Description                        Read/Write
29 307 jshamlet
--   0x00  AAAAAAAA Minor Version                         (RO)
30
--   0x01  AAAAAAAA Major Version                         (RO)
31 270 jshamlet
--
32
-- Revision History
33
-- Author          Date     Change
34
------------------ -------- ---------------------------------------------------
35
-- Seth Henry      10/21/20 Initial design
36
 
37
library ieee;
38
  use ieee.std_logic_1164.all;
39
  use ieee.std_logic_unsigned.all;
40
  use ieee.std_logic_arith.all;
41
  use ieee.std_logic_misc.all;
42
 
43
library work;
44
  use work.open8_pkg.all;
45
 
46
entity o8_version is
47
generic(
48
  Minor_Version              : DATA_TYPE := x"00";
49
  Major_Version              : DATA_TYPE := x"00";
50
  Address                    : ADDRESS_TYPE
51
);
52
port(
53
  Open8_Bus                  : in  OPEN8_BUS_TYPE;
54
  Rd_Data                    : out DATA_TYPE
55
);
56
end entity;
57
 
58
architecture behave of o8_version is
59
 
60
  alias Clock                is Open8_Bus.Clock;
61
  alias Reset                is Open8_Bus.Reset;
62
 
63
  constant User_Addr         : std_logic_vector(15 downto 1)
64
                               := Address(15 downto 1);
65
  alias  Comp_Addr           is Open8_Bus.Address(15 downto 1);
66
  signal Addr_Match          : std_logic;
67
 
68
  alias  Reg_Sel_d           is Open8_Bus.Address(0);
69
  signal Reg_Sel_q           : std_logic := '0';
70
  signal Rd_En_d             : std_logic := '0';
71
  signal Rd_En_q             : std_logic := '0';
72
 
73
begin
74
 
75
  Addr_Match                 <= '1' when Comp_Addr = User_Addr else '0';
76
  Rd_En_d                    <= Addr_Match and Open8_Bus.Rd_En;
77
 
78
  io_reg: process( Clock, Reset )
79
  begin
80
    if( Reset = Reset_Level )then
81
      Reg_Sel_q              <= '0';
82
      Rd_En_q                <= '0';
83
      Rd_Data                <= OPEN8_NULLBUS;
84
    elsif( rising_edge( Clock ) )then
85
      Reg_Sel_q              <= Reg_Sel_d;
86
 
87
      Rd_Data                <= OPEN8_NULLBUS;
88
      Rd_En_q                <= Rd_En_d;
89
 
90
      if( Rd_En_q = '1' )then
91
        if( Reg_Sel_q = '0')then
92
          Rd_Data            <= Minor_Version;
93
        else
94
          Rd_Data            <= Major_Version;
95
        end if;
96
      end if;
97
    end if;
98
  end process;
99
 
100
end architecture;

powered by: WebSVN 2.1.0

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