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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [system/] [decoder.vhdl] - Blame information for rev 9

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

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY IEEE;
21
USE IEEE.STD_LOGIC_1164.ALL;
22
USE IEEE.numeric_std.ALL;
23
 
24
-- The decoder is a special component. It must map the desired IO addresses to
25
-- the different IO components and also select the output bus.
26
-- Its output are enable signals for IO devices, and a value to select the
27
-- input for the output bus multiplexer.
28
-- Current mapping:
29
-- Address space is X"0000" to X"7FFF"
30
-- Boot program is  X"7FF0" to X"7FFF"
31
-- gpio_1 is        X"7FD0" to X"7FD3"
32
-- gpio_2 is        X"7FD4" to X"7FD7"
33
-- gpio_3 is        X"7FD8" to X"7FDB"
34
-- IO ports are mapped to input 0 to 6 of the multiplexer, and memory is mapped
35
-- to input 7
36
-- Change: instead of decoding the MAR register, the decoder will take its
37
-- input now from the register file B output and register its outputs at the
38
-- same as the MAR.
39
 
40
ENTITY decoder IS
41
  PORT (
42
    clk     : IN  STD_LOGIC;
43
    ena     : IN  STD_LOGIC;
44
    a1      : IN  STD_LOGIC_VECTOR(14 DOWNTO 0);
45
    gpio_1  : OUT STD_LOGIC;
46
    gpio_2  : OUT STD_LOGIC;
47
    gpio_3  : OUT STD_LOGIC;
48
    bus_sel : OUT STD_LOGIC_VECTOR(2 DOWNTO 0));
49
END ENTITY decoder;
50
 
51
ARCHITECTURE Behavioral OF decoder IS
52
 
53
BEGIN  -- Behavioral
54
 
55
  PROCESS (CLK)
56
  BEGIN
57
 
58
    IF rising_edge(CLK) THEN
59
 
60
      gpio_1  <= '0';
61
      gpio_2  <= '0';
62
      gpio_3  <= '0';
63
      bus_sel <= "111";
64
 
65
      IF ena = '1' THEN
66
 
67
        CASE a1 IS
68
          WHEN "111" & X"FE0" =>
69
            gpio_1  <= '1';
70
            bus_sel <= "000";
71
          WHEN "111" & X"FE1" =>
72
            gpio_2  <= '1';
73
            bus_sel <= "001";
74
          WHEN "111" & X"FE2" =>
75
            gpio_3  <= '1';
76
            bus_sel <= "010";
77
          WHEN OTHERS =>
78
            NULL;
79
        END CASE;
80
 
81
      END IF;
82
 
83
    END IF;
84
 
85
  END PROCESS;
86
 
87
END Behavioral;

powered by: WebSVN 2.1.0

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