The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 3rd, 2024, 9:14am
Pages: 1
Send Topic Print
Please help (Read 81 times)
2raghu
New Member
*
Offline



Posts: 2
India
Please help
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
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: Please help
Reply #1 - 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
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Please help
Reply #2 - 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
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
2raghu
New Member
*
Offline



Posts: 2
India
Re: Please help
Reply #3 - Sep 14th, 2006, 11:18pm
 
Yes exactly,the values are overridden for every iteration...

thank you.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: Please help
Reply #4 - 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?)
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.