Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHi Tricky,
. --- Quote Start --- try putting the [] after the function parameter --- Quote End --- I done that, but didn´t work yet; returns the same error as posted above (http://www.alteraforum.com/forum/showthread.php?t=47733&p=196390#post196390) on post# 16, even made all the changes proposed. It should not to be so hard to make a simple function in SV having the same struct type, either in Input and Output --- Quote Start --- Have you got a circuit diagram of your intended architecture? This should be the first step before writing any HDL (its a description language after all, without the circuit, how do you expect to describe it?) --- Quote End --- The operating principle is so simple, that is not even worthy of elaboration of a state diagram. Basically it is a state sequencer, a kind of up counter (represented by the main state in each case statement), which eventually in some states, must remain there, then running machines of internal states. --- Quote Start --- Given your description, I would forget about having a struct with two states, just have two discrete variables. Have one working in one always block, and the second in another always block that is only active when the first is in the correct state --- Quote End --- Note at this link here (http://www.mcu.net.br/phpbb/blog.php?action=view&article_id=13) ( not translated ) that there is state amount somewhat in the order of almost 100, what substantiate to me try to do something more elaborate, removing the working of substates processing from the allways block, and then putting it into specific functions (which as I said, is still in a draft form). The logic behind the encapsulation of the variables into a single type, it is because I intend to define States and Substates numerically so that with a simple math, it is possible to know when it was reached the end of Substates, and then be able to continue on to the next upper level state. This logic will not present here a while just for we focus the attention in the main question. I will certainly consider the suggestions that you put up on redesign, but the reason for what I insist on trying to solve the initial question (function with struct with in and out) is to allow me to learn the available resources SV language. --- Quote Start --- I would suggest forgetting about functions. Functions and tasks in HDL should only really be used to tidy away code that is repeated over and over --- Quote End --- This function will be used in several parts of the program. As I mentioned, the entire code above is just a template. Anway, now it has become a matter of honor, a personal challenge : Regardless if in the course of this project I will adopt another approach like the one you suggested, I really wish to know how to implement a struct based function, used at either input and output. Many thanks for your support. Andre.