home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 130,263 of 131,241   
   Kent Dickey to user5857@newsgrouper.org.invalid   
   Re: Tonights Tradeoff - constants / rout   
   12 Nov 25 06:20:53   
   
   From: kegs@provalid.com   
      
   In article <1762377694-5857@newsgrouper.org>,   
   MitchAlsup   wrote:   
   >My 66000 ISA has OpCodes in the range {I.major >= 8 && I.major < 24}   
   >that can supply constants and perform operand routing. Within this   
   >range; instruction<8:5> specify the following table:   
   >   
   >0 0 0 0    +Src1    +Src2   
   >0 0 0 1    +Src1    -Src2   
   >0 0 1 0    -Src1    +Src2   
   >0 0 1 1    -Src1    -Src2   
   >0 1 0 0    +Src1    +imm5   
   >0 1 0 1    +Imm5    +Src2   
   >0 1 1 0    -Src1    -Imm5   
   >0 1 1 1    +Imm5    -Src2   
   >1 0 0 0    +Src1    Imm32   
   >1 0 0 1    Imm32    +Src2   
   >1 0 1 0    -Src1    Imm32   
   >1 0 1 1    Imm32    -Src2   
   >1 1 0 0    +Src1    Imm64   
   >1 1 0 1    Imm64    +Src2   
   >1 1 1 0    -Src1    Imm64   
   >1 1 1 1    Imm64    -Src2   
   >   
   >Here we have access to {5, 32, 64}-bit constants, 16-bit constants   
   >come from different OpCodes.   
   >   
   >Imm5 are the register specifier bits: range {-31..31} for integer and   
   >logical, range {-15.5..15.5} for floating point.   
      
   For FP, Arm32 has an 8-bit immediate turned into an FP number as follows:   
      
   sign = imm8<7>;   
   exp = NOT(imm8<6>):Replicate(imm8<6>,E-3):imm8<5:4>;   
   frac = imm8<3:0>:Zeros(F-4);   
   result = sign : exp : frac;   
      
   For Float, exp[7:0] can be 0x80-0x83 or 0x7c-0x7f, which is 2^1 through 2^4   
   and 2^-3 through 2^0.  And the mantissa upper 4 bits are from the immediate   
   field.  Note that 0.0 is not encodeable, and I'm going to assume you   
   don't need it either.   
      
   For your FP, the sign comes from elsewhere, so you have 5 bits for the   
   FP number.  I suggest you use the Arm32 encoding for the exponent (using   
   3 bits), and then set the upper 2 bits of the mantissa from the remaining   
   two immediate bits.   
      
   This encodes integers from 1.0 through 8.0, and can also encode 10.0, 12.0,   
   14.0, 16.0, 20.0, 24.0, and 28.0.  And it can do 0.5, 1.5, 2.5, 3.5.   
   And it can encode 0.125 and 0.25.   
      
   This encoding makes a lot of sense from ease of decode.  However, it   
   would be nice to be able to encode 100.0, 1000.0 and .1, .01 and .001, each   
   of which is likely to be more useful than 12.0 or 3.5.   
      
   From a compiler standpoint, having arbitrary constants is perfectly fine,   
   it can just look up if it's available.  So you can make 1000.0 and .001   
   and PI and lg2(e) and ln(2), and whatever available, if you want.   
   GCC looks up Arm64 integer 13-bit immediates in a hashtable--the encoding   
   is almost a one-way function, so it's just faster to look it up rather than   
   try to figure out if 0xaaaaaaaa is encodeable out by inspecting the value.   
   So something similar could be done for FP constants.  Since the values will   
   be fixed, a perfect hash can be created ensuring it's a fast lookup.   
      
   Kent   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca