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

Subversion Repositories pc_fpga_com

[/] [pc_fpga_com/] [trunk/] [PC_FPGA_PLATFPORM/] [HARDWARE/] [DATA_OUT_MUX.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 NikosAl
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    16:25:55 03/21/2011 
6
-- Design Name: 
7
-- Module Name:    DATA_OUT_MUX - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
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
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.STD_LOGIC_UNSIGNED.ALL;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
--library UNISIM;
28
--use UNISIM.VComponents.all;
29
 
30
entity DATA_OUT_MUX is
31
    Port ( status : in  STD_LOGIC_VECTOR (2 downto 0);
32
           addr : in  STD_LOGIC_VECTOR (2 downto 0);
33
                          usr_d_on: in  STD_LOGIC;
34
           data_8 : in  STD_LOGIC_VECTOR (7 downto 0);
35
           data_16 : in  STD_LOGIC_VECTOR (15 downto 0);
36
           data_32 : in  STD_LOGIC_VECTOR (31 downto 0);
37
           data_64 : in  STD_LOGIC_VECTOR (63 downto 0);
38
           data_out : out  STD_LOGIC_VECTOR (7 downto 0));
39
end DATA_OUT_MUX;
40
 
41
architecture Behavioral of DATA_OUT_MUX is
42
 
43
signal sel_char, sel_short, sel_int, sel_float, sel_long, sel_double: std_logic;
44
signal sel_char_v, sel_short_v, sel_int_v, sel_double_v: std_logic_vector(7 downto 0);
45
signal char_data, short_data, int_data, double_data: std_logic_vector(7 downto 0);
46
signal sel_shortA, sel_shortB: std_logic;
47
signal sel_intA, sel_intB, sel_intC, sel_intD: std_logic;
48
signal sel_doubleA_v, sel_doubleB_v, sel_doubleC_v, sel_doubleD_v,
49
                 sel_doubleE_v, sel_doubleF_v, sel_doubleG_v, sel_doubleH_v: std_logic_vector(7 downto 0);
50
signal sel_shortA_v, sel_shortB_v: std_logic_vector(7 downto 0);
51
signal sel_intA_v, sel_intB_v, sel_intC_v, sel_intD_v: std_logic_vector(7 downto 0);
52
signal sel1, sel2, sel3, sel4, sel5, sel6, sel7, sel8: std_logic;
53
 
54
begin
55
 
56
sel_char        <= (not status(2)) and (not status(1)) and (    status(0));
57
sel_short       <= (not status(2)) and (    status(1)) and (not status(0));
58
sel_int                 <= (not status(2)) and (    status(1)) and (    status(0));
59
sel_float       <= (    status(2)) and (not status(1)) and (not status(0));
60
sel_long        <= (    status(2)) and (not status(1)) and (    status(0));
61
sel_double      <= (    status(2)) and (    status(1)) and (not status(0));
62
 
63
sel_char_v <= (others=> sel_char);
64
sel_short_v <= (others=> sel_short);
65
sel_int_v <= (others=> sel_int or sel_float);
66
sel_double_v <= (others=> sel_long or sel_double);
67
 
68
char_data <= data_8;
69
 
70
 
71
sel1 <= (not addr(2)) and (not addr(1)) and (not addr(0));
72
sel2 <= (not addr(2)) and (not addr(1)) and (    addr(0));
73
sel3 <= (not addr(2)) and (    addr(1)) and (not addr(0));
74
sel4 <= (not addr(2)) and (    addr(1)) and (    addr(0));
75
sel5 <= (    addr(2)) and (not addr(1)) and (not addr(0));
76
sel6 <= (    addr(2)) and (not addr(1)) and (    addr(0));
77
sel7 <= (    addr(2)) and (    addr(1)) and (not addr(0));
78
sel8 <= (    addr(2)) and (    addr(1)) and (    addr(0));
79
 
80
 
81
sel_shortA <= sel1 or sel3 or sel5 or sel7;
82
sel_shortB <= sel2 or sel4 or sel6 or sel8;
83
 
84
sel_shortA_v <=(others=> sel_shortA);
85
sel_shortB_v <=(others=> sel_shortB);
86
 
87
short_data <= (sel_shortA_v and data_16(15 downto 8)) or ((sel_shortB_v and data_16(7 downto 0)));
88
 
89
 
90
 
91
sel_intA <= sel1 or sel5;
92
sel_intB <= sel2 or sel6;
93
sel_intC <= sel3 or sel7;
94
sel_intD <= sel4 or sel8;
95
 
96
sel_intA_v <= (others=> sel_intA);
97
sel_intB_v <= (others=> sel_intB);
98
sel_intC_v <= (others=> sel_intC);
99
sel_intD_v <= (others=> sel_intD);
100
 
101
 
102
int_data <= (sel_intA_v and data_32(31 downto 24)) or
103
                                (sel_intB_v and data_32(23 downto 16)) or
104
                                (sel_intC_v and data_32(15 downto 8)) or
105
                                (sel_intD_v and data_32(7 downto 0)) ;
106
 
107
 
108
sel_doubleA_v <= (others=> sel1);
109
sel_doubleB_v <= (others=> sel2);
110
sel_doubleC_v <= (others=> sel3);
111
sel_doubleD_v <= (others=> sel4);
112
sel_doubleE_v <= (others=> sel5);
113
sel_doubleF_v <= (others=> sel6);
114
sel_doubleG_v <= (others=> sel7);
115
sel_doubleH_v <= (others=> sel8);
116
 
117
double_data <= (sel_doubleA_v and data_64(63 downto 56)) or
118
                                        (sel_doubleB_v and data_64(55 downto 48)) or
119
                                        (sel_doubleC_v and data_64(47 downto 40)) or
120
                                        (sel_doubleD_v and data_64(39 downto 32)) or
121
                                        (sel_doubleE_v and data_64(31 downto 24)) or
122
                                        (sel_doubleF_v and data_64(23 downto 16)) or
123
                                        (sel_doubleG_v and data_64(15 downto 8)) or
124
                                        (sel_doubleH_v and data_64(7 downto 0)) ;
125
 
126
 
127
data_out <= (sel_char_v and char_data) or
128
                                (sel_short_v and short_data) or
129
                                (sel_int_v and int_data) or
130
                                (sel_double_v and double_data) ;
131
 
132
end Behavioral;
133
 

powered by: WebSVN 2.1.0

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