Duke Scarring schrieb:
> Immerhin gibt der Synthesizer (xst) eine - wenn auch nicht direkt
> ziehlführende - Warnung aus.
Synplify (Lattice) sagt:
1 | @W: CL159 :"...\stdlogicarith.vhd":8:8:8:12 | Input value is unused
|
Klar, denn value kann mit seinen 3 Bits niemals größer als 8
werden...
Und, falls einer fragt, das passiert auch hier, wenn man traditionsgemäß
einen std_logic_vector übergibt und die std_logic_unsigned.all hernimmt:
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | use ieee.std_logic_arith.all; -- to avoid like the plague
|
4 | use IEEE.std_logic_unsigned.all; -- to avoid like the plague
|
5 |
|
6 | entity arith_test is
|
7 | port(
|
8 | value : in std_logic_vector(2 downto 0);
|
9 | greater : out std_ulogic
|
10 | );
|
11 | end entity arith_test;
|
12 |
|
13 | architecture rtl of arith_test is
|
14 |
|
15 | begin
|
16 |
|
17 | process(value)
|
18 | begin
|
19 | greater <= '0';
|
20 | if value > 8 then
|
21 | greater <= '1';
|
22 | end if;
|
23 | end process;
|
24 |
|
25 | end architecture rtl;
|
26 |
|
27 |
|
28 |
|
29 | library ieee;
|
30 | use ieee.std_logic_1164.all;
|
31 | use ieee.std_logic_arith.all; -- to avoid like the plague
|
32 | use IEEE.std_logic_unsigned.all; -- to avoid like the plague
|
33 |
|
34 | entity arith_test_tb is
|
35 | end entity arith_test_tb;
|
36 |
|
37 | architecture testbench of arith_test_tb is
|
38 |
|
39 | signal tb_value : std_logic_vector(2 downto 0);
|
40 | signal tb_greater : std_ulogic;
|
41 |
|
42 | begin
|
43 |
|
44 | dut: entity work.arith_test
|
45 | port map (
|
46 | value => tb_value,
|
47 | greater => tb_greater
|
48 | );
|
49 |
|
50 |
|
51 | process
|
52 | begin
|
53 | tb_value <= "000";
|
54 | wait for 10 ns;
|
55 | report "--------> new value: 0";
|
56 | if tb_greater = '1' then
|
57 | report "YES: it's greater then 8";
|
58 | end if;
|
59 |
|
60 | tb_value <= "110";
|
61 | wait for 10 ns;
|
62 | report "--------> new value: 6";
|
63 | if tb_greater = '1' then
|
64 | report "YES: it's greater then 8";
|
65 | end if;
|
66 |
|
67 | wait; -- forever
|
68 | end process;
|
69 |
|
70 | end architecture testbench;
|
Ja was passiert denn überhaupt, fragen jetzt die, die das nicht selber
simulieren können oder wollen?
Das hier (Aldec Active-HDL):
1 | # EXECUTION:: NOTE : --------> new value: 0
|
2 | # EXECUTION:: NOTE : YES: it's greater then 8
|
3 |
|
4 | # EXECUTION:: NOTE : --------> new value: 6
|
5 | # EXECUTION:: NOTE : YES: it's greater then 8
|