addition problem in Modelsim

Status
Not open for further replies.

zxy499495828

Newbie level 2
Joined
Jul 4, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
14
the simple code of 2*2 matrix addition is as following:


in this second figure, the result of MSB is reversed in the first period. However, it becomes correct in the second period.
as seen in the first figure, it is a simple code.

Anyone can give me help on this?
 

Well, of course it is. This is synchronous logic, so you apply inputs "a" and "b", and the sum of those will appear on "c" the very next clock cycle.

Put another way, you have your a and b inputs ... then follows the actual combinational logic that does the addition. You don't see that in simulation, but should you synthesize it to real hardware this combinational logic will be there. And the outputs of that combinational logic is going to the input of a bunch of flip-flops aka registers aka that output logic. And then on the next posedge of your clock this result is clocked into the registers, and that is the result you see here in your sim with the 1 cycle delay.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…