delay not wanted vhdl

Guest #3668813
Rate this post
• ▲ useful
▼ not useful
Hi every one,

I'm writing a code for a dac in vhdl and I have some troubles during 
simulation: a delay appears on two signals what is not what I want...

My code:
1
library IEEE;
2
use IEEE.std_logic_1164.all;
3
use ieee.numeric_std.all;
4

5
entity dac is
6

7
  generic (data_width : integer;
8
     SDI_width  : integer;
9
     REF        : real);
10
     
11
  port(  SDI   : in  std_logic_vector (SDI_width - 1 downto 0);
12
    SDO   : out std_logic_vector(SDI_width - 1 downto 0);
13
    SCK   : in  std_logic;
14
    CLR   : in  std_logic;  -- low level active
15
    CS_LD : in  std_logic;   -- '0': CS / '1': LD
16
    LDAC  : in  std_logic;  -- low level active
17
    Vout  : out real
18
      );
19
    
20
end dac;
21

22
architecture archi of dac is  
23

24
signal data      : std_logic_vector(11 downto 0);
25
signal data_real : real;
26

27
begin
28

29
  data <= SDI(15) & SDI(14) & SDI(13) & SDI(12) & SDI(11) & SDI(10) &
30
    SDI(9) & SDI(8) & SDI(7) & SDI(6) & SDI(5) & SDI(4);    
31
  
32
  P1: process(SCK)
33
  begin
34
    
35
    data_real <= (real(to_integer(signed(data))));
36

37
    if (CLR = '0' or CS_LD = '0') then
38
    
39
      Vout <= 0.0;
40
      
41
    elsif (SCK'event and SCK = '1') then
42
      
43
      Vout <= data_real/(2.0**data_width) * REF;
44
      
45
    end if;
46
    
47
  end process;
48
  
49
      
50
end archi;

In simulation this is a delay of 5 ns on the "data_real" signal and 15 
ns on the signal "Vout".

Do you know what is wrong in my code and how to fix it please ?
Moderator (Company: Titel) #3668896
Rate this post
• ▲ useful
▼ not useful
angelo wrote:
> In simulation this is a delay of 5 ns on the "data_real" signal and 15
> ns on the signal "Vout".
Your problem ist the wrong sensitivity list...

Try this and think about it:
1
  P1: process(SCK,data,CLR,CS_LD) ...

THis line can be shortened:
1
data <= SDI(15) & SDI(14) & SDI(13) & SDI(12) & SDI(11) & SDI(10) &
2
    SDI(9) & SDI(8) & SDI(7) & SDI(6) & SDI(5) & SDI(4);
Try it this way:
1
data <= SDI(15 downto 4);
Guest #3668932
Rate this post
• ▲ useful
▼ not useful
Hi,

Thank you for your answer, with all your advices the issue is 
fixed...partially.

No more delay on data_real signal, but still on Vout signal. Now it's a 
5 ns delay instead 15 ns.

Did I miss something ?

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.