blob: dd09ef2503a4d3f2feaeb8636adf5a76d9070fc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity etest is
end;
architecture atest of etest is
function foo(a : std_logic_vector) return unsigned is
variable v : unsigned(3 downto 0):=(others=>'0') ;
begin
v := v + unsigned(a(1 downto 1));
return v;
end;
begin
test : process
variable v : std_logic_vector(3 downto 0) ;
variable w : std_logic_vector(0 to 3);
variable x : unsigned(3 downto 0) ;
begin
x := foo(w);
-- x := x + unsigned(w(0 downto 0)) ;
wait;
end process ; -- test
end;
|