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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.communication/] [n2h2/] [1.0/] [vhd/] [one_hot_mux.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : one hot mux for one bit
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : one_hot_mux.vhd
6
-- Author     : kulmala3
7
-- Created    : 16.06.2005
8
-- Last update: 25.06.2007
9
-- Description: select signal is one-hot, otherwise - a mux for one bit.
10
-- Asynchronous.
11
-------------------------------------------------------------------------------
12
-- Copyright (c) 2005 
13
-------------------------------------------------------------------------------
14
-- Revisions  :
15
-- Date        Version  Author  Description
16
-- 16.06.2005  1.0      AK      Created
17
-------------------------------------------------------------------------------
18
 
19
library ieee;
20
use ieee.std_logic_1164.all;
21
use ieee.std_logic_arith.all;
22
use ieee.std_logic_unsigned.all;
23
use ieee.std_logic_misc.all;
24
 
25
entity one_hot_mux is
26
 
27
  generic (
28
    data_width_g : integer := 0);
29
 
30
  port (
31
    data_in  : in  std_logic_vector(data_width_g-1 downto 0);
32
    sel_in   : in  std_logic_vector(data_width_g-1 downto 0);
33
    data_out : out std_logic
34
    );
35
 
36
end one_hot_mux;
37
 
38
architecture rtl of one_hot_mux is
39
 
40
begin  -- rtl
41
 
42
  m: process (data_in, sel_in)
43
    variable temp : std_logic_vector(data_width_g-1 downto 0);
44
  begin  -- process m
45
 
46
    for i in 0 to data_width_g-1 loop
47
      temp(i) := sel_in(i) and data_in(i);
48
    end loop;  -- i
49
 
50
  data_out <= or_reduce(temp);
51
 
52
  end process m;
53
 
54
 
55
end rtl;

powered by: WebSVN 2.1.0

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