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

Subversion Repositories present

[/] [present/] [trunk/] [32BitIO/] [rtl/] [vhdl/] [mux80.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 gajos
-----------------------------------------------------------------------
2
----                                                               ----
3
---- Present - a lightweight block cipher project                  ----
4
----                                                               ----
5
---- This file is part of the Present - a lightweight block        ----
6
---- cipher project                                                ----
7
---- http://www.http://opencores.org/project,present               ----
8
----                                                               ----
9
---- Description:                                                  ----
10
----     This is not "strict" implementation of multiplexer but    ----
11
---- contains its functionality. There are two inputs. One -       ----
12
---- 32 bit input, and one 80 bit input - because of way, in which ----
13
---- Present is working. For more information see below            ----
14
---- To Do:                                                        ----
15
----                                                               ----
16
---- Author(s):                                                    ----
17
---- - Krzysztof Gajewski, gajos@opencores.org                     ----
18
----                       k.gajewski@gmail.com                    ----
19
----                                                               ----
20
-----------------------------------------------------------------------
21
----                                                               ----
22
---- Copyright (C) 2013 Authors and OPENCORES.ORG                  ----
23
----                                                               ----
24
---- This source file may be used and distributed without          ----
25
---- restriction provided that this copyright statement is not     ----
26
---- removed from the file and that any derivative work contains   ----
27
---- the original copyright notice and the associated disclaimer.  ----
28
----                                                               ----
29
---- This source file is free software; you can redistribute it    ----
30
---- and-or modify it under the terms of the GNU Lesser General    ----
31
---- Public License as published by the Free Software Foundation;  ----
32
---- either version 2.1 of the License, or (at your option) any    ----
33
---- later version.                                                ----
34
----                                                               ----
35
---- This source is distributed in the hope that it will be        ----
36
---- useful, but WITHOUT ANY WARRANTY; without even the implied    ----
37
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       ----
38
---- PURPOSE. See the GNU Lesser General Public License for more   ----
39
---- details.                                                      ----
40
----                                                               ----
41
---- You should have received a copy of the GNU Lesser General     ----
42
---- Public License along with this source; if not, download it    ----
43
---- from http://www.opencores.org/lgpl.shtml                      ----
44
----                                                               ----
45
-----------------------------------------------------------------------
46 2 gajos
library IEEE;
47
use IEEE.STD_LOGIC_1164.ALL;
48
use work.kody.ALL;
49
 
50
-- Uncomment the following library declaration if using
51
-- arithmetic functions with Signed or Unsigned values
52
--use IEEE.NUMERIC_STD.ALL;
53
 
54
-- Uncomment the following library declaration if instantiating
55
-- any Xilinx primitives in this code.
56
--library UNISIM;
57
--use UNISIM.VComponents.all;
58
 
59
entity mux80 is
60
        generic (
61
                w_2 : integer := 2;
62
                w_32 : integer := 32;
63
                w_80 : integer := 80
64
        );
65
        port(
66
                i0ctrl : in std_logic_vector (w_2-1 downto 0);
67
                input0 : in std_logic_vector(w_32-1 downto 0);
68
                input1 : in std_logic_vector(w_80-1 downto 0);
69
                output : inout std_logic_vector(w_80-1 downto 0);
70
                ctrl, clk, reset : in std_logic
71
        );
72
end mux80;
73
 
74
architecture Behavioral of mux80 is
75
 
76
begin
77
        inne : process (clk, reset)
78
                begin
79
                        if (reset = '1') then
80
                                output <= (others => '0');
81
                        elsif (clk'Event and clk = '1') then
82
                                        if ctrl = '0' then
83 4 gajos
                                            -- load least significant 32 bits of output from input0 (32 bit wide)
84 2 gajos
                                                if (i0ctrl = in_ld_reg_L ) then
85
                                                        output <= output(80-1 downto 32) & input0;
86 4 gajos
                                                -- load "middle" significant 32 bits of output from input0 (32 bit wide)
87 2 gajos
                                                elsif (i0ctrl = in_ld_reg_H) then
88
                                                        output <= output(79 downto 64) & input0 & output(31 downto 0);
89 4 gajos
                                                -- load most significant 16 bits of output from input0 (16 bit wide)
90 2 gajos
                                                elsif (i0ctrl = in_ld_reg_HH) then
91
                                                        output <= input0(15 downto 0) & output(63 downto 0);
92
                                                else
93 4 gajos
                                                -- do nothing
94 2 gajos
                                                        output <= output;
95 4 gajos
                                                end if;
96
                                        -- on output goes data from 80 bit input
97 2 gajos
                                        else
98
                                                output <= input1;
99
                                end if;
100
                        end if;
101
                end process inne;
102
end Behavioral;
103
 

powered by: WebSVN 2.1.0

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