goto statement is recommened in systemc?

Y

youngsun park

Guest
I am looking at some systemc code and found that
goto is used pretty frequently.

Anybody has some idea about if it is good
practice or not?

I heard that a guy proved that you can program without
goto statement. Is it still valid in hardware modeling
like systemc?


-young.
 
On 16 Oct 2003 11:31:26 -0700, rosepark22@hotmail.com (youngsun park)
wrote:

I am looking at some systemc code and found that
goto is used pretty frequently.

Anybody has some idea about if it is good
practice or not?

I heard that a guy proved that you can program without
goto statement.
You can, but there are times when you can't create code that is as
small or fast without using the goto. It's probably good practice to
avoid goto when you can use other functions and get the same results.
Gotos are not as readable.

Is it still valid in hardware modeling
like systemc?
I'll have to pass on that one. Although I think it would depend on
the exact problem and the data dependencies involved. Hardware allows
parallelism that software does not because of the sequential nature of
the processor. Also, I have never used systemc.

Marion McCoskey
http://www.mcky.net
 
Whether goto's can be synthesized or not depends on your synthesis
tool. But to answer your original question, goto's are not
recommended in SystemC. That's certainly true for synthesis, and it's
a good idea in C/C++ in general, as well.

If you're interested in learning more about SystemC, I'd suggest
looking into the free SystemC online training on our website:

http://LearnSystemC.ForteDS.com

===================
David Pursley
Forte Design Systems (http://www.ForteDS.com)


Marion McCoskey <mrck@charter.net> wrote in message news:<ja39rvggsoq1tq7qhrg2hapar188cqitn0@4ax.com>...
On 16 Oct 2003 11:31:26 -0700, rosepark22@hotmail.com (youngsun park)
wrote:

I am looking at some systemc code and found that
goto is used pretty frequently.

Anybody has some idea about if it is good
practice or not?

I heard that a guy proved that you can program without
goto statement.

You can, but there are times when you can't create code that is as
small or fast without using the goto. It's probably good practice to
avoid goto when you can use other functions and get the same results.
Gotos are not as readable.

Is it still valid in hardware modeling
like systemc?

I'll have to pass on that one. Although I think it would depend on
the exact problem and the data dependencies involved. Hardware allows
parallelism that software does not because of the sequential nature of
the processor. Also, I have never used systemc.

Marion McCoskey
http://www.mcky.net
 

Welcome to EDABoard.com

Sponsor

Back
Top