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

Subversion Repositories v6502

[/] [v6502/] [trunk/] [addrmux.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 Valerio63
library IEEE;
2
use IEEE.std_logic_1164.all;  -- defines std_logic types
3
use IEEE.STD_LOGIC_unsigned.all;
4
use IEEE.STD_LOGIC_arith.all;
5
 
6
-- 16 bit two-way multiplexer
7
entity addrmux is
8
  port(  sel:  in STD_LOGIC_VECTOR(1 downto 0);
9
           a:  in STD_LOGIC_VECTOR(15 downto 0);
10
           b:  in STD_LOGIC_VECTOR(15 downto 0);
11
           s:  in STD_LOGIC_VECTOR(15 downto 0);
12
           y: out STD_LOGIC_VECTOR(15 downto 0)
13
      );
14
end addrmux;
15
 
16
architecture comb of addrmux is
17
constant ADPC: STD_LOGIC_VECTOR(1 downto 0) := "00";  -- select PC
18
constant ADMP: STD_LOGIC_VECTOR(1 downto 0) := "01";  -- select MP
19
constant ADSP: STD_LOGIC_VECTOR(1 downto 0) := "10";  -- select SP
20
constant ADNP: STD_LOGIC_VECTOR(1 downto 0) := "00";  -- no operation
21
begin
22
  process(sel,a,b,s)
23
  begin
24
    case sel is
25
      when ADPC   => y <= a;
26
      when ADMP   => y <= b;
27
      when ADSP   => y <= s;
28
      when others => y <= a;
29
    end case;
30
  end process;
31
end comb;
32
 
33
 

powered by: WebSVN 2.1.0

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