![]() |
Behavioral model for a two out of five detector
Hey everyone, I am having trouble writing a behavioral model for a two out of five bit detector. Y is always undefined when I simulate it, what am I doing wrong? Here is the code:
Code:
library ieee; |
possible solutio
Change cnt declaration to variable or try to code using logical equation.
with 5 bit vector, the possible values of less than two 1's are 00000 00001 00010 00100 01000 10000 eq =not( (a.b.c.d.e)+(a.b.c.d.E)+(a.b.c.D.e)+(a.b.C.d.e)+(a .B.c.d.e)+(A.b.c.d.e) ) Quote:
|
Ok, so I tried that and got the same result, also, Y gets '1' only when there are exactly two out of five are high.
Here is the current code: Code:
library ieee; |
Hi, I am getting the correct result when I simulate the code. BTW, which synthesis and simulation tools are you using.
Quote:
|
I am using QuestiaSim-64 6.4c. I am not synthesizing it, I am just simulating it with a force file. Here are the contents of the force file:
force A 0 0, 1 10 ns -repeat 10 ns force B 0 0, 1 20 ns -repeat 20 ns force C 0 0, 1 30 ns -repeat 30 ns force D 0 0, 1 40 ns -repeat 40 ns force E 0 0, 1 50 ns -repeat 50 ns |
Ok, so I got it working finally the other day. I created a new project and copied the code into a new file and it all worked well. Have no idea what caused such odd behavior. Thanks so much for your help.
|
| All times are GMT. The time now is 07:17 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.