cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bahnan
Participant
Participant
2,943 Views
Registered: ‎04-13-2010

Adder 2 bit simulation error

Jump to solution

Hi Eilert! The simulation take me a good result. Thanks you very much  for your help. C:\Users\sqaisar\Desktop\design\Sans titre.jpg

 

Bahnan

Message Edited by bahnan on 04-14-2010 12:53 AM
Message Edited by bahnan on 04-20-2010 07:34 AM
Tags (1)
adder2bit.bmp
0 Kudos
Reply
1 Solution

Accepted Solutions
eilert
Teacher
Teacher
3,443 Views
Registered: ‎08-14-2007

Hi,

this is a simple one:

 You are using positional association for the port mapping.

 Your component port declaration says : a,b,cin,cout,sum

 But in your instances you use:               a,b,cin,sum,cout

 

So the two outputs are twisted, a wrong carry is propagated and the whole thing fails badly.

 

Two hints for better and saver code:

1) Do the component port declaration like you did it in the entity: One signal per line. 

    It helps you later, when you write more complex models to keep it maintainable.

 

2) use named association only. It's more to write but much safer.:

 

A0: add1 port map( a => a(0),
b => b(0),
-- you can even add comments here
cin => '0', -- set to zero instead of using cin, for some unknown reason
cout => c1,
sum => sum(0));

 

 With named association the order of the ports is no longer imporetant.

 

Have a nice simulation

 Eilert

View solution in original post

0 Kudos
Reply
1 Reply
eilert
Teacher
Teacher
3,444 Views
Registered: ‎08-14-2007

Hi,

this is a simple one:

 You are using positional association for the port mapping.

 Your component port declaration says : a,b,cin,cout,sum

 But in your instances you use:               a,b,cin,sum,cout

 

So the two outputs are twisted, a wrong carry is propagated and the whole thing fails badly.

 

Two hints for better and saver code:

1) Do the component port declaration like you did it in the entity: One signal per line. 

    It helps you later, when you write more complex models to keep it maintainable.

 

2) use named association only. It's more to write but much safer.:

 

A0: add1 port map( a => a(0),
b => b(0),
-- you can even add comments here
cin => '0', -- set to zero instead of using cin, for some unknown reason
cout => c1,
sum => sum(0));

 

 With named association the order of the ports is no longer imporetant.

 

Have a nice simulation

 Eilert

View solution in original post

0 Kudos
Reply