4
$\begingroup$

I am wondering if it is possible to have a program that interprets programming code and is capable of turning that code into an optimized circuit. Is this possible, and if so, does it exist?

$\endgroup$
  • $\begingroup$ At present I think the question is too broad and thus not likely to yield an answer that is useful to you. Can you narrow down your question? Why do you ask? What problem do you face that has prompted this question? Is there a specific program you want to compile in this way? A specific programming language? Why do you want a circuit, and what do you plan to do with the circuit? $\endgroup$ – D.W. Jul 31 '14 at 23:48
  • $\begingroup$ I was looking for a way to make specialized hardware for simple programs that do heavy calculations. A good example would be a raytracer or hash algorithm. $\endgroup$ – Tyler Scott Aug 1 '14 at 4:46
  • 1
    $\begingroup$ The Wikipedia article "C to HDL" might be of interest. $\endgroup$ – Paul A. Clayton Aug 1 '14 at 13:11
  • $\begingroup$ Ahhh. Yes, Paul Clayton's suggestion is a good one. You can also find work on compiling systems code (e.g., C code) into a form that can be executed on a FGPA, which is in a very similar vein. However, you might find that you get better performance by implementing the algorithm by hand in AHDL/VHDL, than by compiling from C code -- you'd have to experiment to be sure, but that's my guess. $\endgroup$ – D.W. Aug 1 '14 at 17:20
8
$\begingroup$

Yes, it is certainly possible.

There are compilers that will compile from code to circuits. Classic examples would be VHDL or AHDL compilers, but you can certainly do this for any other language, to the extent that you have an upper bound on the running time of the program or that you have an upper bound on the memory use of the program and are willing to have a circuit that contains stateful elements.

In fact, you can walk down to Fry's and buy something that basically has the form you asked for: it's called a computer. That's more or less what a computer does: it takes code written in a programming language and executes it efficiently, using an optimized circuit. Part of the circuit is fixed (it is the gates in the processor) and part of it is data that depends upon the program you are executing (it is the RAM of the computer).

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

there are different ways to interpret your question but based on comments (incl yours) some of this may be helpful. there is a lot of research in converting higher level programming constructs into FPGAs, field programmable gate arrays, basically hardware where circuits are dynamically reconfigurable. (aka reconfigurable computing).

there is also a special language eg "C for FPGAs", a subset of full C, that is customized for this purpose.

as for getting efficient circuits for particular programs, that is another area of research/ optimization eg circuit optimization/ minimization/ compression. there are also optimization heuristics built as input preprocessors into most SAT solvers. more generally this is known as logic optimization and there are various techniques/ tools for that. also the general theory/ application of optimizing compilers has some overlap with circuit optimization. one simple, near "toy" example or model of a compiler optimization in some cases is short circuit evaluation. the general area you refer to is also an active area of research both theoretical/ applied & there are many related papers on the subject.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.