The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Please help
https://designers-guide.org/forum/YaBB.pl?num=1158077930

Message started by 2raghu on Sep 12th, 2006, 9:18am

Title: Please help
Post by 2raghu on Sep 12th, 2006, 9:18am

I'm a newbie to the verilog language. I would like to explain my problem with a C program example:
main()
{
int i;
for(i=0;i<3;i++)
{
static int a=1,b=2,x=0,y=1;
add(a,b);
a++;b++;
mul(x,y);
x++;y++;
}
}
add(int,int)
{
statements;
}
mul(int,int)
{
statements;
}

Here we can see that the functions add() and mul() are called for every iteration and also  their parameters are updated and passed for every iteration....

Now my problem:

I have two sub-modules in main module(top-level). I need do to the iterations for 5 rounds...So can you please tell me how can I do the iteration and at same time passing the parameters into the sub modules...

Hope you understood the problem...Hoping for the positive response..

Thanks a Ton.

Regards,
Raghu

Title: Re: Please help
Post by jbdavid on Sep 12th, 2006, 11:39pm

Might do better with a spice macro model example..
for my own part, "c" is not a valuable language .. perl, python or SKILL I have actually used. c?
I might as well go back to assembly..
Not fair probably .. but then I don't write programs just for the joy of writing programs.. I only do it to get something done..  
Maybe you can recast your issue in  pseudo code or python.. ?

Good luck..
jbd

Title: Re: Please help
Post by Geoffrey_Coram on Sep 14th, 2006, 8:35am

Your code doesn't show what you want to do with the results of adding and multiplying.

Does the result of one iteration get overwritten by the result for the next?

You can't pass the values in as parameters.  Maybe as wires?  Seems more a digital Verilog question, not really AMS (though, of course, digital is a subset of AMS).

-Geoffrey

Title: Re: Please help
Post by 2raghu on Sep 14th, 2006, 11:18pm

Yes exactly,the values are overridden for every iteration...

thank you.

Title: Re: Please help
Post by Geoffrey_Coram on Sep 15th, 2006, 8:43am

I still don't understand what you are trying to do.  What happens with the arithmetic results?  (Why do the loop, if you only want the last values?)

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.