how to make large macro paste the code as it is

J

Jean-Marc Bourguet

I want to make them local to function for better results. will it
compile otherwise ?


b'coz i first know the code that uses the variable and then list of
all the variables. since i am generating the code, that means our tool
writing the C code in file, first the code is written that uses the
varable and then i know at the end of function what my list of
variables conclude. So i want to insert a macro immediately after the
opening brace that will expand to variable declarations later.

Are you aware that you need to define the macro *before* the function.
Whatever mean you are using to achieve that (including #include), you can
use it to have the variables definitions in the function without reaching
line length limit.

Yours,
 
J

Jean-Marc Bourguet

Keith Thompson said:
Agreed. And I think there's plenty of circuit emulation software out
there already; a quick Google search turns up the GNU package Gnucap,
and the Gnucap page refers to something called Spice. I don't know
enough to offer an opinion on either.

I don't know about Gnucap but Spice isn't at the same level of abstraction
(to summarize a lot, Spice is analog time, analog signals; what the OP
seems to want is discreet time, discreet signals).

Yours,
 
J

Jean-Marc Bourguet

I think i mentioned it somewhere earlier in my posts, but i repeat it
here. In simple terms I am writing a tool which takes a digital
circuit and writes equivalent C code for it. For simulation purpose.

Why the existing simulators don't suit your needs?

I don't intend to be harsh, but you seem too inexperienced for considering
seriously the simulation of million gates circuits -- while I'm working for
an EDA vendor, I've never touched a simulation engine and I can see that.
There can be circuit of million of gates. Since, I am writing in C ,which
is a sequential programming language, I might want to evaluate some
portion of logic cone prior than other.

Your netlist is a DAG, do a DFS starting with your output.
Different function have to be written for evaluating each port.

Your logical cones probably overlap. You'll reevaluate things, if your
goal is performance, that's not the right approach.
I hope it gives a better feeling about the problem but problem is same
that writing functions for logic cone evaluation while traversing the
digital cicruit and then generating the code such that it uses minimum
number of variables etc.

See how to do register allocation in compiler text books.

Yours,
 

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

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top