OpenCores
URL https://opencores.org/ocsvn/am9080_cpu_based_on_microcoded_am29xx_bit-slices/am9080_cpu_based_on_microcoded_am29xx_bit-slices/trunk

Subversion Repositories am9080_cpu_based_on_microcoded_am29xx_bit-slices

[/] [am9080_cpu_based_on_microcoded_am29xx_bit-slices/] [trunk/] [simpledevice.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 zpekic
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    11:56:00 11/12/2017 
6
-- Design Name: 
7
-- Module Name:    simpledevice - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: Simple wrapper for parallel I/O ports and maybe more
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity simpledevice is
33
    Port ( clk: in std_logic;
34
                          reset: in std_logic;
35
                          D : inout  STD_LOGIC_VECTOR (7 downto 0);
36
           A : in  STD_LOGIC_VECTOR(3 downto 0);
37
           nRead : in  STD_LOGIC;
38
           nWrite : in  STD_LOGIC;
39
           nSelect : in  STD_LOGIC;
40
                          IntReq: buffer std_logic;
41
                          IntAck: in STD_LOGIC;
42
           direct_in : in  STD_LOGIC_VECTOR (15 downto 0);
43
           direct_out : out STD_LOGIC_VECTOR (15 downto 0));
44
end simpledevice;
45
 
46
architecture Behavioral of simpledevice is
47
 
48
signal d_out: std_logic_vector(7 downto 0);
49
signal readSelect, writeSelect: std_logic;
50
 
51
begin
52
 
53
readSelect <= nSelect nor nRead;
54
writeSelect <= nSelect nor nWrite;
55
 
56
D <= d_out when (readSelect = '1') else "ZZZZZZZZ";
57
 
58
with A select
59
        d_out <= direct_in(7 downto 0) when "0000",
60
                                direct_in(15 downto 8) when "0001",
61
                                X"FF" when others;
62
 
63
IntReq <= '0'; -- generate no interrupt for now
64
 
65
set_output: process(reset, clk, writeSelect, D, A)
66
begin
67
        if (reset = '1') then
68
                direct_out <= X"FFFF";
69
        else
70
                if (rising_edge(clk) and writeSelect = '1') then
71
                        case A is
72
                                when "0000" =>
73
                                        direct_out(7 downto 0) <= D;
74
                                when "0001" =>
75
                                        direct_out(15 downto 8) <= D;
76
                                when others =>
77
                                        null;
78
                        end case;
79
                end if;
80
        end if;
81
end process;
82
 
83
end Behavioral;
84
 

powered by: WebSVN 2.1.0

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