What is the error in the code below and why does vivado output u

OP (Company: Yildiz Technical University) #7417830
Rate this post
• ▲ useful
▼ not useful

I don't see any sintax errors but the value of both my outputs is "u". why do you think?

1
library IEEE;
2
use IEEE.STD_LOGIC_1164.all;
3
use IEEE.numeric_std.all;
4
use IEEE.std_logic_unsigned.all;
5

6
entity DDR is
7
  port (
8
      ALARM_TIME     : in std_logic_vector (3 downto 0);
9
      CURRENT_TIME   : in std_logic_vector (3 downto 0);
10
      SHOW_A      : in std_logic;
11
      -----
12
      DISPLAY      : out std_logic_vector (6 downto 0);
13
      SOUND_ALARM    : out std_logic
14
    );
15
end DDR;
16

17
architecture RTL of DDR is
18

19
  signal DISP_CURRENT  : std_logic_vector (6 downto 0);
20
  signal DISP_ALARM  : std_logic_vector (6 downto 0);
21
  
22
  begin
23
    DISP_CURRENT      <=   "0111111" when CURRENT_TIME="0000" else --0
24
              "0000110" when CURRENT_TIME="0001" else --1
25
              "1011011" when CURRENT_TIME="0010" else --2
26
              "1001111" when CURRENT_TIME="0011" else --3
27
              "1100110" when CURRENT_TIME="0100" else --4
28
              "1101101" when CURRENT_TIME="0101" else --5
29
              "1111101" when CURRENT_TIME="0110" else --6
30
              "0000111" when CURRENT_TIME="0111" else --7
31
              "1111111" when CURRENT_TIME="1000" else --8
32
              "1101111" when CURRENT_TIME="1001" else --9
33
              "1100011"   ;      
34
      
35
    DISP_ALARM       <=   "0111111" when ALARM_TIME="0000" else --0
36
              "0000110" when ALARM_TIME="0001" else --1
37
              "1011011" when ALARM_TIME="0010" else --2
38
              "1001111" when ALARM_TIME="0011" else --3
39
              "1100110" when ALARM_TIME="0100" else --4
40
              "1101101" when ALARM_TIME="0101" else --5
41
              "1111101" when ALARM_TIME="0110" else --6
42
              "0000111" when ALARM_TIME="0111" else --7
43
              "1111111" when ALARM_TIME="1000" else --8
44
              "1101111" when ALARM_TIME="1001" else --9
45
              "1100011"   ;            
46
  
47
  process (DISP_ALARM, SHOW_A, DISP_CURRENT) is
48
    begin
49
      if SHOW_A = '1' then
50
        DISPLAY <= DISP_ALARM;
51
      else 
52
        DISPLAY <= DISP_CURRENT;
53
      end if;
54
  end process;
55
  
56
  --DISPLAY     <= DISP_ALARM when SHOW_A = '1' else DISP_CURRENT; 
57

58
  SOUND_ALARM   <= '1' when DISP_ALARM = DISP_CURRENT else '0';
59
    
60
end RTL;

TESTBENCH

1
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3

4
--library work;
5
--use work.P_DISP1.all;
6

7
entity t_DDR is
8

9
end t_DDR;
10

11
architecture RTL of t_DDR is
12
  component DDR is
13
    port (
14
        ALARM_TIME     : in std_logic_vector (3 downto 0);
15
        CURRENT_TIME   : in std_logic_vector (3 downto 0);
16
        SHOW_A      : in std_logic;
17
        -----
18
        DISPLAY      : out std_logic_vector (6 downto 0);
19
        SOUND_ALARM    : out std_logic
20
      );
21
  end component;
22

23
    signal ALARM_TIME     : std_logic_vector (3 downto 0);
24
    signal CURRENT_TIME   : std_logic_vector (3 downto 0);
25
    signal SHOW_A      : std_logic;
26
    signal DISPLAY      : std_logic_vector (6 downto 0);
27
    signal SOUND_ALARM    : std_logic;
28
    signal DISP_ALARM    : std_logic_vector (6 downto 0);
29
    signal DISP_CURRENT    : std_logic_vector (6 downto 0);
30
    
31
    begin
32
  
33
    uut : DDR port map
34
      (
35
        ALARM_TIME    => ALARM_TIME,
36
        CURRENT_TIME   => CURRENT_TIME,
37
        SHOW_A       => SHOW_A,
38
        DISPLAY       => DISPLAY,
39
        SOUND_ALARM   => SOUND_ALARM
40
      );
41
      
42
    process
43
      begin
44
      
45
        ALARM_TIME     <= "0110";
46
        CURRENT_TIME   <= "1001";
47
        SHOW_A       <= '1';
48
        wait for 20 ns;
49
--        DISP1(DISPLAY);
50
        
51
        ALARM_TIME     <= "0111";
52
        CURRENT_TIME   <= "1000";
53
        SHOW_A       <= '0';
54
        wait for 20 ns;
55
--        DISP1(DISPLAY);
56
        
57
        ALARM_TIME     <= "0011";
58
        CURRENT_TIME   <= "0000";
59
        SHOW_A       <= '1';
60
        wait for 20 ns;
61
--        DISP1(DISPLAY);
62
        
63
        ALARM_TIME     <= "0111";
64
        CURRENT_TIME   <= "0110";
65
        SHOW_A       <= '0';
66
        wait for 20 ns;
67
--        DISP1(DISPLAY);
68
        
69
        ALARM_TIME     <= "1001";
70
        CURRENT_TIME   <= "1001";
71
        SHOW_A       <= '1';
72
        wait for 20 ns;
73
--        DISP1(DISPLAY);    
74
      wait;
75
      
76
    end process;
77
  
78
  end RTL;

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.