📄 rfc401.txt
字号:
Network Working Group Jim HansenRequest for Comment #401 Center for AdvancedNIC #11923 ComputationCategory: D.6 University of IllinoisUpdates: RFC #387 October 23, 1972Obsoletes: None Conversion of NGP-0 Coordinates to Device ----------------------------------------- Specific Coordinates --------------------Conversion of NGP-0 coordinates to floating point PDP-10 coordinateswas discussed in RFC #387. In general, however, it is undesirable toconvert NGP coordinates to floating point coordinates because realdevices require integer addressing. To this end, a means is describedto convert NGP coordi- nates to integer coordinates in the range zeroto M, where M is the maximum address of the device screen on a machineusing 2's complement arithmetic. It would not, however, be difficultto modify this algorithm to operate on machines using one's complementor sign-magnitude arithmetic.First consider the NGP coordinate format: +--+-----------+ | | n | +--+-----------+ s ^ FRACTION i g nWhere the sign occupies the most significant bit of the coordinatefollowed by bits of numerical information (initial implementation ofNGP requires N=15). Negative numbers are represented by 2'scomplement. Conversion to device coordinates is accomplished by: D = S * f + SWhere D =>integer device coordinate S =>scaling factor (typically M/2) f =>NGP fractional coordinateLet us rewrite this as: n n D = S*(2 *f)/2 +S [Page 1]Now factor S into two terms: I S= Q * 2Where Q is an odd integer and I is an integer.When: I n n D = Q * 2 *(2 *f)/2 +S I-n n = Q * 2 *(2 *f) +S nThe factor (2 *f) is represented in 2's complement form simply byextending the sign bit of f into the upper portion of the computerword, If Q = 1 (as it would be with many devices), it can be ignored.If Q >< 1, we may console ourselves that an integer multiply is fasteron most machines than a floating point multiply. In fact, on aPDP-10, this multiply can usually be performed with no access tomemory since Q is usually small. I-nWe are now left with the 2 factor. This can be accomplished with anarithmetic shift left by (I-n) or an arithmetic shift right by (n-I)as is appropriate. The offset factor, S, may now be added using aninteger add.The procedure for converting NGP coordinates to integer devicecoordinates is then: 1. move coordinate to a register and extend sign 2. integer multiply by Q (if necessary) 3. arithmetic shift left by (I-n) 4. integer add SThis procedure would generally be much faster than: 1. move coordinate to register and extend sign 2. float fractional coordinate 3. floating point multiply 4. floating point add 5. conversion to fixed point [ This RFC was put into machine readable form for entry ] [ into the online RFC archives by BBN Corp. under the ] [ direction of Alex McKenzie. 1/97 ] [Page 2]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -