Almost offtopic about HDL optimizing.

Hi. I see how Quartus synthesizer removes unused parts of algorithm implemented in HDL, optimizes it and so on. Other synthesizers probably do the same. My question is almost offtopic: is there any method to do the same in software code? Is the starting point is in compiler theory or there're also another topics?

Reply to
sdf
Loading thread data ...

Compiler optimizations are done differently. Each method it self is a lot more primitive than what is done for hardware optimization, but a decent compiler uses a larger set of these optimization strategies.

I did many years of research in circuit optimization and allways wondered whether it would be fruitful to apply more computational intensive algorithms to critical code in software.

A starting point could be the work done in compiling software descriptions to hardware. UC Berkeley for example simulates the code and postulates theories on the data range of variables. (e.g. int x is allways smaller than 100). They then use solvers to proof these assumptions. If proven, the information can be used for optimization. This approach is computationally very expensive.

Also: It turns out that many variable are only written once during program execution. This means that there is a big optimization potential to optimize a program after startup. Java and .NET do this to some extend but in principle you could also do with C and other languages.

Kolja Sulimma

Reply to
Kolja Sulimma

It looks like a paradox, but it looks like functional programming. Paradox is in likeness of such low-level computation device and such high-level methods... I just noticed that if to transform algorithm written in C to something which looks like FP program, it is then can be more easily rewritten into HDL, manually, of course.

Reply to
sdf

All that you could save would be object or executable file size. And who cares about the file size these days... If you are interested to find out which parts of your software code will never get executed, there are tools for that available...

/Mikhail

Reply to
MM

That is not true. The methods to find equivalent signals in circuits are much more sophisticated compared to the methods to find common subexpressions in software albeit the problems are very similar. I am also confident that there are more loop invariants than current compilers are able to find.

Both are speed optimizations, not code size optimizations.

Reply to
Kolja Sulimma

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.