Peter Nachtwey
Member
I am wondering if it is worth writing an IL compiler.
I see no need for IL if there is ST.
I see no need for IL if there is ST.
This statement raises the question, what if ST was just as efficient?Only in very time critical processing.
Basically it look like you could live without it if ST were more efficient.eg a very often called subroutine. In the last 3 years I have not had to use either. Before that IL was in use on a servo system that I had to modify and maintain.
IEC IL and Simens STL are two different things.Siemens - German programmers seem to only program in IL
I don't understand exactly but...IL - If this was available then it is possible for someone to efficiently process C code on your controller, eg from a externally generated model.
Would you really want to do that if you ST generated code just as efficient?I would have thought that you could use a pre-processor on the ST to convert it into IL that you could then compile.
This is why I am asking.Getting you both for the price of one compiler. Hmm that would still be a lot of work.
Matlab and ST are very different. I don't understand.I think that just ensuring that you have a interface that accepts matlab models would be useful. ST works for that.
I didn't know that. It seems that many big companies say the have ST or auto tuning just so the marketing guys can say they have it.As an aside
I have been investigating the Rockwell ST timing for a:= b + c;
It is shocking - If I had IL then I could make it much better. I had to rewrite it in LD as that was optimized.
Rockwell ST converts a:= b + c; into
z := b+c;
a:= z;
An unnecessary assignment when all are the same data type
Could be. I would never let my compiler writer get away with that. However, my compiler writer decided to get a PhD in Divinity and move to Edinburgh Scottland so now I am the compiler writer. I new replacement newbie compiler writer. This is why I am asking.I believe the reason this occurs is to make their life simple in compound statements
eg a:= b + c + d + e;
breaks down into
z := b + c;
z:= z + d;
z:= z + e;
a:= z; with any conversion required eg REAL to DINT.
This statement raises the question, what if ST was just as efficient?
Basically it look like you could live without it if ST were more efficient.
Matlab and ST are very different. I don't understand.
I didn't know that. It seems that many big companies say the have ST or auto tuning just so the marketing guys can say they have it.
I think that it depends on where you are taking your product - Full IEC 61131 - 3 using LD, ST, IL, and FBD, Probably not. Having LD and ST very likely, remembering that your product is for engineers not bubba.I would prefer to convert ST directly to machine code and skip the IL intermediate step that then must be converted to machine code.
LDI b
LDI c
ADDI
STI a
The good part is that if the ST converts to IL then it will work on any CPU, only the IL compiler needs to be written.
We don't compile down to a IL but it is something close. Our 'IL' is more stack like. Memory is only accessed using load and store instructions. Other operations use the data on the top of the stack. This way we avoid have many different types of ADD instruction. Some CPU have 8 addressing mores or more for each basic instruction and we wanted to avoid that.In ST you do not know the timing in IL you do
, as the instructions are machinecode and you can calculate how many cycles are needed.
That is the point of assembler, at least as I learned it in college on IBM mainframe. 1 assembly instruction = 1 machine instruction. The program does "exactly" what the programmer tells it to do.Peter Nachtwey said:I have never seen any assembler optimize assembler code.