16 Jan 2012 09:37
FW: Problem with instruction description
youssef fahmi <yflelion <at> hotmail.fr>
2012-01-16 08:37:07 GMT
2012-01-16 08:37:07 GMT
Hello, I am working on the porting of binutils to a new architecture. This processor has an instruction of the form: ld rx,[r1] + imm6 [load the 32 bit word at the address calculated from the contents of r1 plus the 6 bit immediate value (multiplied by 4) ] In summary: rx <- mem[r1 + imm6 * 4] I need to generate code for this instruction, but only in the case where the code generator in the compiler generates a standard load, but with an offset appropriate for the imm6 value. That is to say the immediate value would be less than 256 and be a multiple of 4 (word access). This is the description that I am using at the moment: (df-f imm6x4 "imm6x4" () 11 6 UINT ((value pc) (sra WI value (const 2))) ((value pc) (sll WI value (const 2)))) (dnop imm6x4 "imm6x4" () h-uint f-imm6x4) (dni ldstack-r1-imm6x4 "ldstack r1#imm6x4" () "ld $r1,[r1]+$imm6x4" (+ (f-stack-opcode #05) r1 imm6x4) () ()) However this description causes the "ld rx,[r1] + imm6" to be used whenever the immediate vallue is less than 256, and not JUST when the offset is also a multiple of 4. How do I alter this description so that it only operates when the immediate value is less than 256 AND ALSO a multiple of 4. I have already tried.... but this generates code with this instruction in these cases ;;; which are not appropriate.How do I achieve this? I guess that I'll have to create an attribute to handle this, but I could not get an attribute that suits me. is there a way to create an attribute of type integer, for example, but with only specific integers not necessarily following.(Continue reading)
RSS Feed