04-13-2010 02:12 AM - edited 04-20-2010 07:34 AM
Hi Eilert! The simulation take me a good result. Thanks you very much for your help.
Bahnan
04-13-2010 10:41 PM
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
04-13-2010 10:41 PM
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