goto statement is recommened in systemc?

Y

youngsun park

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.
 
M

Marion McCoskey

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
 
D

David Pursley

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top