Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Why on Simulation the result is not what is expected?

Reply
Thread Tools

Why on Simulation the result is not what is expected?

 
 
b.g.dariush@gmail.com
Guest
Posts: n/a
 
      11-18-2012
Hey guys
I have a presentation for next couple days on VHDL and i need to show
some simple example project, I managed to write a <b>4 Bit Adder</b> as
follow:
Adder4.vhd:
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;

ENTITY Adder4 IS
PORT
(
Cin : IN STD_LOGIC;
X, Y : IN STD_LOGIC_VECTOR (3 DOWNTO 0);
R : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);
Cout : OUT STD_LOGIC
);
END Adder4;

ARCHITECTURE Adder4_Behav OF Adder4 IS
SIGNAL Carry : STD_LOGIC_VECTOR ( 2 DOWNTO 0);

COMPONENT FullAdder
PORT
(
Cin, A, B : IN STD_LOGIC;
Cout, S : OUT STD_LOGIC
);
END COMPONENT;
BEGIN
FA0: FullAdder PORT MAP ( Cin, X(0), Y(0), Carry(0), R(0));
FA1: FullAdder PORT MAP ( Carry(0), X(1), Y(1), Carry(1), R(1));
FA3: FullAdder PORT MAP ( Carry(1),X(2),Y(2),Carry(2),R(2));
FA4: FullAdder PORT MAP ( Carry(2),X(3),Y(3),Cout,R(3));
END;
--------------------------------------------------------------------------------

FullAdder.vhd

--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;

ENTITY FullAdder IS
PORT
(
Cin, A, B : IN STD_LOGIC;
Cout, S : OUT STD_LOGIC
);
END FullAdder;

ARCHITECTURE FullAdder_Behav OF FullAdder IS
BEGIN
S <= A XOR B XOR Cin;
Cout <= (A AND Cin) OR (B AND Cin) OR (A AND B);
END;
--------------------------------------------------------------------------------

but when i run simulation the output result is not synced at all!
I know i am not considering something here, but what is that?
I need HELP ASAP, please
What is it that i am doing wrong!?

I don't see any attachment option here
but i have uploaded the .vwf and the simulation result as attachments
in
http://embdev.net/attachment/160752/..._Wave_File.png

AND

http://embdev.net/attachment/160753/Simu_Result.jpg

Thanks in advace
 
Reply With Quote
 
 
 
 
Nicolas Matringe
Guest
Posts: n/a
 
      11-18-2012
Le 18/11/2012 20:36, a écrit :
> Hey guys

[...]
> but when i run simulation the output result is not synced at all!
> I know i am not considering something here, but what is that?
> I need HELP ASAP, please
> What is it that i am doing wrong!?


Absolutely nothing.
You are simulating an implemented design and what you see is actual gate
delays. That's how the real world works. What did you expect ?

Nicolas

 
Reply With Quote
 
 
 
 
rickman
Guest
Posts: n/a
 
      11-18-2012
On 11/18/2012 2:36 PM, wrote:
> Hey guys
> I have a presentation for next couple days on VHDL and i need to show
> some simple example project, I managed to write a<b>4 Bit Adder</b> as
> follow:
> Adder4.vhd:
> --------------------------------------------------------------------------------
> library ieee;
> use ieee.std_logic_1164.all;
>
> ENTITY Adder4 IS
> PORT
> (
> Cin : IN STD_LOGIC;
> X, Y : IN STD_LOGIC_VECTOR (3 DOWNTO 0);
> R : OUT STD_LOGIC_VECTOR (3 DOWNTO 0);
> Cout : OUT STD_LOGIC
> );
> END Adder4;
>
> ARCHITECTURE Adder4_Behav OF Adder4 IS
> SIGNAL Carry : STD_LOGIC_VECTOR ( 2 DOWNTO 0);
>
> COMPONENT FullAdder
> PORT
> (
> Cin, A, B : IN STD_LOGIC;
> Cout, S : OUT STD_LOGIC
> );
> END COMPONENT;
> BEGIN
> FA0: FullAdder PORT MAP ( Cin, X(0), Y(0), Carry(0), R(0));
> FA1: FullAdder PORT MAP ( Carry(0), X(1), Y(1), Carry(1), R(1));
> FA3: FullAdder PORT MAP ( Carry(1),X(2),Y(2),Carry(2),R(2));
> FA4: FullAdder PORT MAP ( Carry(2),X(3),Y(3),Cout,R(3));
> END;
> --------------------------------------------------------------------------------
>
> FullAdder.vhd
>
> --------------------------------------------------------------------------------
> library ieee;
> use ieee.std_logic_1164.all;
>
> ENTITY FullAdder IS
> PORT
> (
> Cin, A, B : IN STD_LOGIC;
> Cout, S : OUT STD_LOGIC
> );
> END FullAdder;
>
> ARCHITECTURE FullAdder_Behav OF FullAdder IS
> BEGIN
> S<= A XOR B XOR Cin;
> Cout<= (A AND Cin) OR (B AND Cin) OR (A AND B);
> END;
> --------------------------------------------------------------------------------
>
> but when i run simulation the output result is not synced at all!
> I know i am not considering something here, but what is that?
> I need HELP ASAP, please
> What is it that i am doing wrong!?
>
> I don't see any attachment option here
> but i have uploaded the .vwf and the simulation result as attachments
> in
> http://embdev.net/attachment/160752/..._Wave_File.png
>
> AND
>
> http://embdev.net/attachment/160753/Simu_Result.jpg
>
> Thanks in advace


You didn't show the test bench file you are using. My guess is that in
your test bench you are generating the X, Y and Cin signals, then
running them through registers before they reach the full adder. It
looks like you are using a 10 nS (100 MHz) clock.

The changes that occur just after the inputs change at 20 and 30 ns in
the latter image are the result of logic delay times. You seem to be
running a timing mode simulation. These will go away if you run a logic
mode simulation which is just on the VHDL code and not on the placed and
routed chip.

Can we see your test bench file? Oh, I see the first image is a vector
file. Is that your stimulus? I don't think I have done that in a long,
long time. You might try writing a test bench instead.

Rick
 
Reply With Quote
 
goouse99@gmail.com
Guest
Posts: n/a
 
      11-19-2012
Am Sonntag, 18. November 2012 22:46:16 UTC+1 schrieb Nicolas Matringe:
> Le 18/11/2012 20:36, b.g. a écrit :
>
> > Hey guys

>
> [...]
>
> > but when i run simulation the output result is not synced at all!

>
> > I know i am not considering something here, but what is that?

>
> > I need HELP ASAP, please

>
> > What is it that i am doing wrong!?

>
>
>
> Absolutely nothing.
>
> You are simulating an implemented design and what you see is actual gate
>
> delays. That's how the real world works. What did you expect ?
>
>
>
> Nicolas


Hi,
I'm not sure about the behavior of the Quartus simulation tool,
But even if this simple combinatorical circuit has been simulated in timingsim mode, why is the first result there immediately (t=0).
Also the inputs seem to be applied to the actual circuit quite late (exceptfor t=0). This might irritate a beginner, because one would expect something different from a simple combinatorical circuit. It might be something caused by this vector file simulation.

As rickman suggested, a HDL Tesbench would be useful.

Have a nice simulation
Eilert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
Problem with post-route simulation / timing simulation jasperng VHDL 0 11-27-2008 06:23 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds Michael Tan Ruby 32 07-21-2005 03:23 PM



Advertisments
 



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 44 45 46 47 48 49 50 51 52 53 54 55 56 57