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 298

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

powered by: WebSVN 2.1.0

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