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

Subversion Repositories v65c816

[/] [v65c816/] [trunk/] [dmux.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 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
-- 8/16 bit three-way multiplexer
7
-- this multiplexer select the operand source for ALU operand #2 (op2) input
8
entity dmux is
9
  port(  sel:  in STD_LOGIC_VECTOR(2 downto 0);
10
           a:  in STD_LOGIC_VECTOR(15 downto 0);
11
           b:  in STD_LOGIC_VECTOR(7 downto 0);
12
           y: out STD_LOGIC_VECTOR(15 downto 0)
13
      );
14
end dmux;
15
 
16
architecture comb of dmux is
17
constant NOP_D: STD_LOGIC_VECTOR(2 downto 0) := "000";
18
constant ORD_D: STD_LOGIC_VECTOR(2 downto 0) := "001";           -- selects 16 bit operand register 
19
constant EXT_D: STD_LOGIC_VECTOR(2 downto 0) := "010";           -- selects 8 bit external data bus
20
constant EXM_D: STD_LOGIC_VECTOR(2 downto 0) := "011";           -- selects msb 8 bit external data bus and lsb operand register  
21
constant BCD_D: STD_LOGIC_VECTOR(2 downto 0) := "100";           -- not used
22
 
23
begin
24
  process(sel,a,b)
25
  begin
26
    case sel is
27
      when ORD_D    => y <= a;                                   -- selects 16 bit operand register
28
      when EXT_D    => y <= "00000000" & b;                      -- selects 8 bit external data bus
29
      when EXM_D    => y <= b & a(7 downto 0);                   -- selects msb 8 bit external data bus and lsb operand register
30
      when others   => y <= "0000000000000000";
31
    end case;
32
  end process;
33
end comb;
34
 
35
 

powered by: WebSVN 2.1.0

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