summaryrefslogtreecommitdiffstats
path: root/examples/todo.vhd
blob: a5695eecd2a65d1a72d12692bfea47028b290858 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity todo is
   port (
      data_i : in  std_logic_vector(7 downto 0);
      data_o : out std_logic_vector(7 downto 0)
   );
end todo;

architecture rtl of todo is
   type mem_type is array (0 to 255) of integer;
   signal mem : mem_type;

   signal int : integer;
   signal uns : unsigned(7 downto 0);
begin
   --**************************************************************************
   -- Wrong translations
   --**************************************************************************
   -- to_integer not always work (probably the same with conv_integer)
   uns <= "10101001";
   int <= mem(to_integer(uns)); -- here work
   int <= to_integer(uns);      -- here fail
   --**************************************************************************
   -- Translations which abort with syntax error (uncomment to test)
   --**************************************************************************
   -- Concatenation in port assignament fail
--   uns <= "0000" & X"1"; -- It is supported
--   dut1_i: signextend
--      port map (
--        i => "00000000" & X"11", -- But here fail
--        o => open
--      );
   -- Unsupported type of instantiation
--   dut2_i: entity work.signextend
--   port map (
--      i => (others => '0'),
--      o => open
--   );

end rtl;
OpenPOWER on IntegriCloud