TW201032069A - Sine/cosine value generation apparatus - Google Patents

Sine/cosine value generation apparatus Download PDF

Info

Publication number
TW201032069A
TW201032069A TW98104798A TW98104798A TW201032069A TW 201032069 A TW201032069 A TW 201032069A TW 98104798 A TW98104798 A TW 98104798A TW 98104798 A TW98104798 A TW 98104798A TW 201032069 A TW201032069 A TW 201032069A
Authority
TW
Taiwan
Prior art keywords
sine
phase
octant
cosine
value
Prior art date
Application number
TW98104798A
Other languages
Chinese (zh)
Other versions
TWI420325B (en
Inventor
Tien-Ju Tsai
Original Assignee
Himax Media Solutions Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Himax Media Solutions Inc filed Critical Himax Media Solutions Inc
Priority to TW98104798A priority Critical patent/TWI420325B/en
Publication of TW201032069A publication Critical patent/TW201032069A/en
Application granted granted Critical
Publication of TWI420325B publication Critical patent/TWI420325B/en

Links

Landscapes

  • Image Processing (AREA)

Abstract

An apparatus for generating sine/cosine values of an input phase is disclosed. The apparatus includes a phase projector, an LUT-arithmetic unit, a temp sine/cosine generator and a sine/cosine value generator. The phase projector maps the input phase angle into an octant phase and determines an octant index indicating which octant the input phase angle actually locates and a flag indicating whether or not the input phase happens to be pi/4, 3*pi/4, 5*pi/4 or 7*pi/4. The LUT-arithmetic unit receives the octant phase for provision of its corresponding sine/cosine values. The temp sine/cosine generator receives the corresponding sine/cosine values of the octant phase for provision of temp sine/cosine values based on the flag. The sine/cosine value generator selectively swaps and inverts the temp sine/cosine values as the sine/cosine values of the input phase based on a swap index derived from the octant index.

Description

201032069 六、發明說明: 【發明所屬之技術領域】 本發明係有關於一箱正 關於-種使用較少記憶體空間的二有 【先前技術】 在許許多多的工程領域Μ,常常會使賴數學函式 ❹201032069 VI. Description of the invention: [Technical field to which the invention pertains] The present invention relates to a box that is related to the use of less memory space. [Prior Art] In many engineering fields, it often makes Mathematical function

的计异,&而,在所有的數學計算中,三角函數 (TdgonometHc F刪tions)雖然相對簡單,但卻是非常重 要。在三角函數的計算當中,正弦/餘弦(sine/c〇峰最 常用的數學函數計算,因為工程領域的相關應用常常以正 弦/餘弦函數為基礎,進而推導衍生出更繁_數學計算。 以通訊X㈣領餘料料妓信號處理機 制中所需用到的最基本訊號形式。 根據數學上的定義,-個圓被分成四個象限,每個象 限具有90度的角度值。在傳統的正弦/餘弦值產生機制中, 通常先把第一㈣(0S 90度)中所有角度的正弦/餘弦值都 計算出並儲存起來,然後利用這些值求出〇至間任意 角度的正弦/餘弦值,但有時候需要加上負號。舉例^說思 參考第1圖,其顯示正弦/餘弦函數的基本特性圖。其中, 對於正弦函數而言,其第一和第二象限的所有值都是正 的,而對於餘弦函數而言,其第一和第四象限的所有值都 是正的。如使一來,若要求出正弦函數之一任意角度的值, 假設是210·度,則必須先把該角度映射至第一象限内的對 應角度,然後才可進一步計算其正弦/餘弦值。更具體地 201032069 說,透過公式:sin(;r + 0) = sin;rcos0 + cos;rsin0,該 210 度的角度可 被轉換成第一象限内的對應角度30度,但最後的結果值必 須再加上負號。因此,210度的正弦值等於30度的正弦值 加負號。在上述的習知方式中,必須事先計算第一象限内 所有正弦/餘弦函數的值,才可進一步求出任意角度的正弦 /餘弦值。 【發明内容】 _ 基於以上的考量,本發明的目的在於提供一種低成本 的正弦/餘弦值產生裝置。與習知方式需要事先計算第一象 限(90度)内所有正弦/餘弦值的特性相比,本發明只需要事 先計算第一八分圓(Octant,45度)内所有的正弦/餘弦值, 便可進而計算出任意角度的正弦/餘弦值,因而節省一半的 記憶體佔用空間。 有鑑於此,本發明揭露一種正弦/餘弦值產生裝置,用 以產生一輸入相位的正弦/餘弦值,包括一相位投射器、一 φ 查表/算術單元、一臨時正弦/餘弦值產生器和一正弦/餘弦 值產生器。相位投射器用以將輸入相位映射至介於八分圓 之内的一八分圓相位,並決定用以判斷輸入相位是否為 pi/4、3*pi/4、5*pi/4或7*pi/4的一旗標。查表/算術單元用 以接收八分圓相位,並輸出對應於八分圓相位的正弦/餘弦 值。臨時正弦/餘弦值產生器用以接收對應於八分圓相位的 正弦/餘弦值,以便根據旗標產生臨時正弦/餘弦值。正弦/ 餘弦值產生器根據用以顯示輸入相位所在之八分圓位置的 * 一八分圓索引,選擇性地將臨時正弦/餘弦值做正弦/餘弦函 5 201032069 數值的對調或改變正負號,以作為上述輸入相位的正弦/餘 弦值。 、 【實施方式】 為使本發明之上述目的、特徵和優點能更明顯易懂, 下文特舉較佳實施例,並配合所附圖式,作詳細說明如下: 第2圖顯示根據本發明一實施例所述之正弦/餘弦值產 生裝置100的方塊圖。正弦/餘弦值產生裝置1〇〇包括一相 參位投射器120、一查表/算術單元HO、一臨時正弦/餘弦值 產生器160和一正弦/餘弦值產生器ι80。在第2圖中’相 位投射器120接收一輸入相位值phase_Value,用以產生一 八分圓相位Phase—Octant、一八分圓索引0ctant_Idx和一 旗標Ph—on_pi/4。查表/算術單元14〇用以接收八分圓相位 Phase_Octant ’並輸出對應的正弦函數值Sin-D〇ut和餘弦 函數值Cos—Dout。臨時正弦/餘弦值產生器16〇用以接收正 弦函數值Sin_Dout、餘弦函數值c〇s_Dout、旗標 φ Ph-on_Pi/4和八分圓索引Octant_Idx,並輸出一對調索引 Invert—Swap、一臨時正弦值Sin_0ct和一臨時餘弦值 Cos_Oct。正弦/餘弦值產生器ι80用以接收對調索引 Invert_Swap、臨時正弦值Sin_0ct和臨時餘弦值 Cos一Oct’並產生最終的正弦值sin_Val和餘弦值Cos_Val。 以下,本發明將說明正弦/餘弦值產生裝置1〇〇的詳細動作 流程。 . 第3圖顯示根據,本發明一實施例所述之相位投射器 120的方塊圖。相位投射器120所接收的輸入相位值 6 201032069In addition, in all mathematical calculations, trigonometric functions (TdgonometHc F deletions) are relatively simple, but they are very important. In the calculation of the trigonometric function, the sine/cosine (the most commonly used mathematical function calculation of sine/c〇, because the related applications in the engineering field are often based on the sine/cosine function, and then the derivative is derived more complicated _ mathematical calculation. X (4) The most basic signal form required in the signal processing mechanism. According to the mathematical definition, - a circle is divided into four quadrants, each quadrant has an angle value of 90 degrees. In the traditional sine / In the cosine generation mechanism, the sine/cosine values of all angles in the first (four) (0S 90 degrees) are usually calculated and stored, and then these values are used to find the sine/cosine values of any angle between 〇, but Sometimes you need to add a negative sign. For example, consider referring to Figure 1, which shows the basic characteristics of the sine/cosine function. For the sine function, all values of the first and second quadrants are positive. For the cosine function, all the values of the first and fourth quadrants are positive. For example, if the value of any angle of one of the sine functions is required, the assumption is 210 degrees, then it must be The angle is mapped to the corresponding angle in the first quadrant before the sine/cosine value can be further calculated. More specifically, 201032069 says, by the formula: sin(;r + 0) = sin;rcos0 + cos;rsin0, the 210 degrees The angle can be converted to a corresponding angle of 30 degrees in the first quadrant, but the final result value must be preceded by a negative sign. Therefore, the sine value of 210 degrees is equal to the sine value of 30 degrees plus a negative sign. In the method, the values of all the sine/cosine functions in the first quadrant must be calculated in advance, and the sine/cosine values of any angle can be further obtained. [Invention] _ Based on the above considerations, the object of the present invention is to provide a low cost. Sine/cosine value generating means. Compared with the conventional method of calculating the characteristics of all sine/cosine values in the first quadrant (90 degrees) in advance, the present invention only needs to calculate the first octant in advance (Octant, 45 degrees). With all the sine/cosine values in it, the sine/cosine values of any angle can be calculated, thus saving half of the memory footprint. In view of this, the present invention discloses a sine/cosine value. Means for generating a sine/cosine value of an input phase, comprising a phase projector, a φ look-up table/arithmetic unit, a temporary sine/cosine value generator, and a sine/cosine value generator. The phase projector is used to The input phase is mapped to an octant phase within an octant and is determined to determine whether the input phase is pi/4, 3*pi/4, 5*pi/4, or 7*pi/4 Flag. The look-up table/arithmetic unit is used to receive the octant phase and output a sine/cosine value corresponding to the octant phase. The temporary sine/cosine generator is used to receive the sine/cosine value corresponding to the octant phase. To generate a temporary sine/cosine value based on the flag. The sine/cosine generator selectively sines the temporary sine/cosine value according to the *-octant index used to display the octant position of the input phase. Cosine function 5 201032069 The value is reversed or changed by the sign to be the sine/cosine value of the above input phase. BRIEF DESCRIPTION OF THE DRAWINGS The above described objects, features, and advantages of the present invention will become more apparent from the description of the preferred embodiments illustrated herein A block diagram of the sine/cosine value generating apparatus 100 described in the embodiment. The sine/cosine value generating means 1 includes a phase position projector 120, a look-up table/arithmetic unit HO, a temporary sine/cosine value generator 160, and a sine/cosine value generator ι80. In Fig. 2, the phase projector 120 receives an input phase value phase_Value for generating an octant phase Phase-Octant, an octant index 0ctant_Idx, and a flag Ph-on_pi/4. The look-up table/arithmetic unit 14 is configured to receive the octant phase Phase_Octant ' and output the corresponding sine function value Sin-D〇ut and the cosine function value Cos_Dout. The temporary sine/cosine value generator 16 is configured to receive the sine function value Sin_Dout, the cosine function value c〇s_Dout, the flag φ Ph-on_Pi/4, and the octant index Octant_Idx, and output a pair of index indexes Invert-Swap, a temporary The sine value Sin_0ct and a temporary cosine value Cos_Oct. The sine/cosine generator ι80 is used to receive the offset index Invert_Swap, the temporary sine value Sin_0ct, and the temporary cosine value Cos-Oct' and produce the final sine value sin_Val and the cosine value Cos_Val. Hereinafter, the present invention will explain the detailed operation flow of the sine/cosine value generating device 1A. Figure 3 shows a block diagram of a phase projector 120 in accordance with an embodiment of the present invention. Input phase value received by phase projector 120 6 201032069

Phase_Value係以N位元表示,分為兩個部分。第一部分 係該N位元的前三高位元,表示為Phase_MSB。而第二部 分係該N位元的後N-3低位元,表示為phase_LSB。另外, 八分圓索引Octant_Idx係用以顯示輸入相位值phase_Value 位於一個圓中的哪個八分圓,如此一來,輸入相位值 Phase_Value的相位位置即可用八分圓索引〇ctant_Idx來定 義。舉例來說,對於一個位於第0個八分圓的輸入相位值 Phase_Value來說’其八分圓索引〇ctant_Idx係表示為 ❿ 〇〇〇。同樣地,對於一個位於第7個八分圓的輸入相位值 Phase_Value來說,其八分圓索引〇ctant_Idx係表示為 111。旗標Ph_on_pi/4係用以顯示輸入相位值phase_Value 是否正好為7!:/4、372:/4、572:/4或772:/4的角度值。對於 輸入相位值Phase_Value正好為角度值;r/4、3 7Γ/4、5 7Γ/4 或7 π/4的情況,有可能會讀取到錯誤的正弦/餘弦值,因 此必須採取另外的措施。必須了解的是,本發明只需要事 先計算並儲存第一八分圓内0至45度所有的正弦/餘弦 Φ 值,便可依此求出任意角度的正弦/餘弦值。 如第3圖所示’相位投射器120包括擷取單元301和 303、一 2的補數碼產生器305、一選擇器307和一邏輯電 路309。榻取早元301用以取传輸入相位值phase Value的 前三高位元(Phase_MSB) ’並輸出八分圓索引〇ctant_Idx。 操取单元303用以取得輸入相位值Phase Value的後N-3 低位元(Phase—LSB)。2的補數碼產生器305用以求出擷取 單元303輸出值的2的補數值。選擇器307用以選擇擷取 單元303的輸出值或2的補數碼產生器3〇5的輸出值,作 7 201032069 為八分圓相位Phase_Octant。其選擇的機制係根據一控制 信號Phase_MSB[0]而定’亦即輸入相位值Phase_Value前 三高位元Phase_MSB的最低位元。換言之,當控制信號 Phase一MSB[0]為1時(亦即輸入相位值phase_Value位於第 1、3、5或7個八分圓之内時),則將擷取單元303輸出值 的2的補數值輸出為八分圓相位phase—Octant。反之,當 控制信號Phase_MSB[0]為〇時(亦即輸入相位值 Phase_Value位於第〇、2、4或6個八分圓之内時),則直 ❹接將擷取單元303的輸出值作為八分圓相位Phase_Value is expressed in N bits and is divided into two parts. The first part is the first three high bits of the N-bit, denoted as Phase_MSB. The second part is the lower N-3 low-order element of the N-bit, which is expressed as phase_LSB. In addition, the octant index Octant_Idx is used to display which octant of the input phase value phase_Value is in a circle, so that the phase position of the input phase value Phase_Value can be defined by the octant index 〇ctant_Idx. For example, for an input phase value Phase_Value at the 0th octant, its octant index 〇ctant_Idx is expressed as ❿ 〇〇〇. Similarly, for an input phase value Phase_Value at the 7th octant, its octant index 〇ctant_Idx is represented as 111. The flag Ph_on_pi/4 is used to display whether the input phase value phase_Value is exactly the angle value of 7!:/4, 372:/4, 572:/4 or 772:/4. For the case where the input phase value Phase_Value is exactly the angle value; r/4, 3 7Γ/4, 5 7Γ/4 or 7 π/4, the wrong sine/cosine value may be read, so additional measures must be taken. . It must be understood that the present invention only needs to calculate and store all sine/cosine Φ values from 0 to 45 degrees in the first octant, and the sine/cosine values of any angle can be obtained therefrom. As shown in Fig. 3, the phase projector 120 includes capture units 301 and 303, a complement digital generator 305, a selector 307, and a logic circuit 309. The early 301 is used to take the first three high bits (Phase_MSB)' of the phase value phase value and output an octant index 〇ctant_Idx. The operation unit 303 is configured to obtain a post N-3 low bit (Phase_LSB) of the input phase value Phase Value. The complement number generator 305 of 2 is used to determine the complement value of 2 of the output value of the capture unit 303. The selector 307 is used to select the output value of the capture unit 303 or the output value of the complement digital generator 3〇5, and 7 201032069 is an octant phase Phase_Octant. The mechanism of its selection is based on a control signal Phase_MSB[0], that is, the lowest bit of the first three high bits Phase_MSB of the input phase value Phase_Value. In other words, when the control signal Phase_MSB[0] is 1 (that is, when the input phase value phase_Value is within the first, third, fifth or seventh octant), the capture unit 303 outputs the value of 2 The complement value output is an octant phase phase-Octant. On the other hand, when the control signal Phase_MSB[0] is 〇 (that is, when the input phase value Phase_Value is within the second, second, fourth or sixth octant), the output value of the capture unit 303 is directly connected as the output value. Octave phase

Phase—Octant。透過擷取單元303、2的補數碼產生器305 和選擇器307’可將輸入相位值phase_Value映射至位於第 0個八分圓之内的對應角度。 如第3圖所示,邏輯電路309接收八分圓相位 Phase_Octant和控制信號Phase_MSB[0],用以產生旗標 Ph_on_pi/4。在本實施例中,邏輯電路3〇9更包括一比較器 311和一及閘313。比較器311用以判斷八分圓相位 Φ Phase_Octant的所有位元是否皆為〇。及閘313只在控制信 號Phase_MSB[0]和比較器311的輸出皆為邏輯1時,將旗 標Ph_on一pi/4拉升為高電位。亦即,及閘313只在控制信 號Phase_MSB[0]的輸出為邏輯1,且八分圓相位 Phase—Octant的所有位元皆為〇時,才將旗標 拉升為尚電位。換言之,在輸入相位值Phase_Value剛好 為 7Γ /4、3 7Γ /4、5 ;Γ /4 或 7 7Γ /4 時,旗標 Ph_on_pi/4 才會 為南電位,狀態。 第4A、4B和4C圖顯示根據本發明所述之查表/算術單 201032069 元140的三個實施例的方塊圖。查表/算術單元14〇用以接 收八分圓相位Phase_Octant,並輸出對應的正弦函數值 Sin_Dout和餘弦函數值cos_Dout。第4A圖顯示根據本發 明所述之查表/算術單元14〇的一實施例,其係以全查表法 (full-Look Up Table (full-LUT) approach)的方式實現。在第 4A圖中,第〇個八分圓内的所有的正弦/餘弦值皆事先計 算’且儲存於一唯讀記憶體(Read-〇niy Memory)中。根據 從相位投射器120所接收的八分圓相位pjiase_Octant,查 ❹表/算術單元140以查表的方式從該唯讀記憶體中讀取對應 的正弦/餘弦值’並將所讀取的正弦/餘弦值輸出為正弦函數 值Sin一Dout和餘弦函數值Cos一Dout。第4B圖顯示根據本 發明所述之查表/算術單元140的另一實施例’其係以全算 術(full-arithmetic)的方式實現。在第4B圖中,第〇個八分 圓内的所有的正弦/餘弦值皆以一個實現坐標旋轉數位電 腦(Coordinate Rotation Digital Computer,CORDIC)疊代演 算法(iteration algorithm)的處理器來事先計算,且一個可藉 ❿著將八分圓相位Phase_Octan乘上常數ττ/4再將結果值截 短成K位元而求得的正規化八分圓相位 Phase一Normalized,可使用該處理器計算其對應的正弦/餘 弦值做為輸出的正弦函數值Sin—Dout和餘弦函數值 Cos_Dout。第4C圖依然顯示根據本發明所述之查表/算術 單元140的另一實施例,其係以查表-算術混合法 (LUT-arithmetic hybrid approach)的方式實現。在第 4C 圖 中,第0個八分圓内的所有的正弦/餘弦值皆儲存於—唯讀 記憶體中’且可藉著將八分圓相位Phase_Octan乘上常數 9 201032069 7Γ /4 ’再將結果值載短成K位元的方式求得一正規化的八 分圓相位Phase一Normalized。該正規化的八分圓相位 Phase—Normalized包括兩個部分:第一部分係正規化八分 圓相位Phase一Normalized的前L個高位元,而第二部分係 正規化八分圓相位Phase_Normalized的後(κ-L)個低位 元。第一部分的正弦/餘弦值可用查表的方式由唯讀記憶體 中5賣取’而第一部分的正弦/餘弦值可用一個實現c〇RDIC 疊代演算法的處理器來計算。由唯讀記憶體所讀取的輸出 ❿值,和實現CORDIC疊代演算法之處理器所輸出的值,兩 者可合併為正弦函數值Sin_D〇ut和餘弦函數值 Cos—Dout。更詳細地說,假設正規化八分圓相位 Phase—Normalized表示為A+B,A為第一部分,而B為第 一 # 刀。由於 s^ + ^sinfcosB+cosfsin^B ,且 cosM + ^mosWC0S5-sinpsil^,因此可藉著查表的方式求出如乂 和smB的值,而藉著使用一個實現c〇RDIC疊代演算法的 處理裔可計算出cod和C0SjB的值,最後再將從唯讀記憶體讀 ❹取的輸出值與處理器的輸出值兩者結合而求出如以+巧和 C〇S〇4 + 5)。第4D圖顯示根據本發明一實施例所述之唯讀記 憶體中的資料儲存格式。在帛4D _的實施例中,餘弦值 係儲存於唯讀記憶體的左邊部分,而正弦值係儲存於唯讀 記憶體的右邊部分。 參考回第2圖,臨時正弦/餘弦值產生器16〇更包括選 擇器501和502 ’以及一查表表格5〇3,如第5A和5B圖 所示。根據所接收.的正弦函數值Sin_D〇ut、餘弦函數值 C〇S_D〇Ut、旗標 Ph—on_pi/4 和八分圓索引 〇ctantJdx,臨 201032069 時正弦/餘弦值產生器160輸出對調索引Invert_Swap、臨 時正弦值Sin_Oct和臨時餘弦值Cos_Oct。參考第5A圖, 選擇器501選擇常數ΤΓ/4或餘弦函數值Cos_Dout作為臨 時餘弦值Cos_Oct,而選擇器502選擇常數ΤΓ/4或正弦函 數值Sin_Dout作為臨時正弦值Sin_Oct。該選擇係根據旗 標Ph_on_pi/4而定。更詳細地說,當輸入相位值 Phase_Value 剛好為 7Γ /4、3 7Γ /4、5 π /4 或 7 π /4 時,旗標 Ph_on_pi/4將會為高電位狀態,且選擇器501和502將常 粵 數ττ/4同時輸出做為臨時正弦值Sin_Oct和臨時餘弦值 Cos_Oct。反之,旗標Ph_on_pi/4將會為低電位狀態,且 選擇器501和502分別將正弦函數值Sin_Dout和餘弦函數 值Cos_Dout輸出做為臨時正弦值Sin_0ct和臨時餘弦值 Cos—Oct 〇 參考第5B圖,在查表表格503中的對調索引 Invert_Swap和八分圓索引Octant_Idx之間具有一對一的映 射關係。在本實施例中,對調索引Invert_Swap和八分圓索 ❹引Octant一Idx皆為三位元。必須了解的是,雖然在本實施 例中查表表袼503係整合於臨時正弦/餘弦值產生器160之 内,但其亦可整合於其他元件中,像是相位投射器120、 查表/算術單元140或正弦/餘弦值產生器18〇。對調索引 Invert_Swap的詳細用法將於稍後說明。 參考回第2圖’根據所接收的對調索引invert_Swap、 臨時正弦值Sin一Oct和臨時餘弦值Cos—Oct,正弦/餘弦值 產生器180產生最終的正弦值Sin__Val和餘弦值cos_Val。 參考第6圖,第一選擇器601和603用以對臨時正弦值 201032069Phase—Octant. The input phase value phase_Value can be mapped to the corresponding angle within the 0th octant by the complement digital generator 305 and the selector 307' of the capture units 303, 2. As shown in Fig. 3, the logic circuit 309 receives the octant phase Phase_Octant and the control signal Phase_MSB[0] for generating the flag Ph_on_pi/4. In this embodiment, the logic circuit 3〇9 further includes a comparator 311 and a gate 313. The comparator 311 is configured to determine whether all of the bits of the octant phase Φ Phase_Octant are 〇. The gate 313 pulls the flag Ph_on_pi/4 to a high level only when the output of the control signal Phase_MSB[0] and the comparator 311 is logic 1. That is, the gate 313 only raises the flag to a good potential when the output of the control signal Phase_MSB[0] is logic 1 and all bits of the octant phase Phase-Octant are 〇. In other words, when the input phase value Phase_Value is just 7Γ /4, 3 7Γ /4, 5 ; Γ /4 or 7 7Γ /4, the flag Ph_on_pi/4 will be the south potential state. Figures 4A, 4B and 4C show block diagrams of three embodiments of look-up table/arithmetic list 201032069 element 140 in accordance with the present invention. The look-up table/arithmetic unit 14 is configured to receive the octant phase Phase_Octant and output a corresponding sine function value Sin_Dout and a cosine function value cos_Dout. Fig. 4A shows an embodiment of the look-up table/arithmetic unit 14A according to the present invention, which is implemented in a full-Look Up Table (full-LUT) approach. In Figure 4A, all sine/cosine values in the first octant are pre-calculated and stored in a read-only memory. Based on the octant phase pjiase_Octant received from the phase projector 120, the lookup table/arithmetic unit 140 reads the corresponding sine/cosine value from the read-only memory in a look-up manner and osines the read sine The /cosine value is output as a sine function value Sin_Dout and a cosine function value Cos-Dout. Figure 4B shows another embodiment of the look-up table/arithmetic unit 140 in accordance with the present invention' which is implemented in a full-arithmetic manner. In Figure 4B, all sine/cosine values in the first octant are calculated in advance by a processor that implements the Coordinate Rotation Digital Computer (CORDIC) iteration algorithm. And a normalized octant phase Phase-Normalized by multiplying the octant phase Phase_Octan by a constant ττ/4 and then truncating the resulting value into K bits, which can be calculated using the processor The corresponding sine/cosine value is taken as the sine function value Sin_Dout and the cosine function value Cos_Dout of the output. Figure 4C still shows another embodiment of the look-up table/arithmetic unit 140 in accordance with the present invention, which is implemented in a LUT-arithmetic hybrid approach. In Figure 4C, all sine/cosine values in the 0th octant are stored in the read-only memory' and can be multiplied by a constant 9 by the octant phase Phase_Octan 9 201032069 7Γ /4 ' A normalized octant phase Phase-Normalized is obtained by shortening the resulting value into K bits. The normalized octant phase Phase-Normalized consists of two parts: the first part is the normalized octant phase Phase-Normalized front L high-order elements, and the second part is the normalized octant phase Phase_Normalized ( κ-L) low bits. The sine/cosine values of the first part can be sold by the look-up memory in a read-only memory 5 and the sine/cosine values of the first part can be calculated by a processor implementing the c〇RDIC iteration algorithm. The output ❿ value read by the read-only memory and the value output by the processor implementing the CORDIC iterative algorithm can be combined into a sine function value Sin_D〇ut and a cosine function value Cos_Dout. In more detail, assume that the normalized octant phase Phase-Normalized is represented as A+B, A is the first part, and B is the first #刀. Since s^ + ^sinfcosB+cosfsin^B and cosM + ^mosWC0S5-sinpsil^, the values of 乂m and smB can be obtained by looking up the table, and by using a c〇RDIC iterative algorithm The handlers can calculate the values of cod and C0SjB, and finally combine the output values read from the read-only memory with the output values of the processor to find the values such as + and C〇S〇4 + 5 ). Fig. 4D is a diagram showing a data storage format in a read-only memory according to an embodiment of the present invention. In the embodiment of 帛4D_, the cosine value is stored in the left part of the read-only memory, and the sine value is stored in the right part of the read-only memory. Referring back to Fig. 2, the temporary sine/cosine value generator 16 further includes selectors 501 and 502' and a look-up table 5〇3 as shown in Figs. 5A and 5B. According to the received sine function value Sin_D〇ut, cosine function value C〇S_D〇Ut, flag Ph_on_pi/4 and octant index 〇ctantJdx, 201032069 sine/cosine value generator 160 output index index Invert_Swap , temporary sine value Sin_Oct and temporary cosine value Cos_Oct. Referring to Fig. 5A, the selector 501 selects the constant ΤΓ/4 or the cosine function value Cos_Dout as the temporary cosine value Cos_Oct, and the selector 502 selects the constant ΤΓ/4 or the sine function Sin_Dout as the temporary sine value Sin_Oct. This selection is based on the flag Ph_on_pi/4. In more detail, when the input phase value Phase_Value is exactly 7Γ /4, 3 7Γ /4, 5 π /4 or 7 π /4, the flag Ph_on_pi/4 will be in a high potential state, and the selectors 501 and 502 The simultaneous output of the constant ττ/4 is taken as the temporary sine value Sin_Oct and the temporary cosine value Cos_Oct. Conversely, the flag Ph_on_pi/4 will be in a low state, and the selectors 501 and 502 respectively output the sine function value Sin_Dout and the cosine function value Cos_Dout as a temporary sine value Sin_0ct and a temporary cosine value Cos_Oct 〇 reference 5B There is a one-to-one mapping relationship between the index index Invert_Swap and the octant index Octant_Idx in the lookup table 503. In this embodiment, the index index Invert_Swap and the octant index Octant-Idx are all three bits. It must be understood that although in this embodiment the look-up table 503 is integrated into the temporary sine/cosine value generator 160, it may be integrated into other components, such as the phase projector 120, look-up table/ The arithmetic unit 140 or the sine/cosine value generator 18〇. The detailed usage of the index index Invert_Swap will be explained later. Referring back to Fig. 2', the sine/cosine value generator 180 produces a final sine value Sin__Val and a cosine value cos_Val according to the received index index invert_Swap, temporary sine value Sin_Oct, and temporary cosine value Cos_Oct. Referring to Figure 6, the first selectors 601 and 603 are used to temporarily sine the value 201032069

Sin_Oct和臨時餘弦值Cos_Oct加上符號(正負號),而帶 有正負號的臨時正弦值Sin_Oct和臨時餘弦值c〇s_Oct則 進一步輸出到第二選擇器605和607。第一選擇器601和 603根據由臨時正弦/餘弦值產生器ι60所輸出的控制信號 Invert_Swap[l]和Invert_Swap[2],個別地選擇臨時正弦值 Sin—Oct和臨時餘弦值Cos一0ct(正值),或著是其2的補數 值(負值)’作為其輸出。另一方面,第二選擇器6〇5和6〇7 亦根據由臨時正弦/餘弦值產生器16〇所輸出的控制信號 Invert_SwaP[0]’選定(1)選擇器6〇3的輸出值為最終的餘弦 值Cos一Val ’選擇器6〇1的輸出值為最終的正弦值 Sm一Val’或著是(2)選擇器6〇1的輸出為最終的餘弦值 Cos一Val ’選擇器603的輪出為最終的正弦值sin_Val。 本發明之正弦7餘弦值產生裝置100至此已完整說明, 然而’雖本發明以較佳實施例揭露如上,但其並非用以限 定本發明的範圍’任何熟習此項技藝者,在不脫離本發明 之精神和範圍内’當可做些許的更動與潤飾,因此本發明 之保護範圍當視後附之申請專利範圍所界定者為準。 12 201032069 【圖式簡單說明】 第1圖顯示正弦/餘弦函數的基本特性圖; 第2圖顯示根據本發明一實施例所述之正弦/餘弦值產 生裝置的方塊圖; 第3圖顯示根據本發明一實施例所述之相位投射器的 方塊圖; 第4A圖顯示根據本發明所述之查表/算術單元的一實 施例,其係以全查表法的方式實現; ❹ 第4B圖顯示根據本發明所述之查表/算術單元的另一 實施例,其係以全算術的方式實現; 第4C圖依然顯示根據本發明所述之查表/算術單元的 另一實施例,其係以查表-算術混合法的方式實現; 第4D圖顯示根據本發明一實施例所述之唯讀記憶體 中的資料儲存格式, 第5A圖顯示根據本發明一實施例所述之臨時正弦/餘 弦值的產生過程; ❹ 第5B圖顯示根據本發明一實施例所述之對調索引和 八分圓索引之間的查表表格;以及 第6圖顯示根據本發明一實施例所述之最終正弦/餘弦 值的產生過程。 【主要元件符號說明】 100〜正弦/餘弦值產生裝置 120〜相位投射器 201032069 140〜查表/算術單元 160〜臨時正弦/餘弦值產生器 180〜正弦/餘弦值產生器 301、303〜擷取單元 305〜2的補數碼產生器 307、501、502、601、603、605、607〜選擇器 309〜邏輯電路The Sin_Oct and the temporary cosine value Cos_Oct are added with a sign (positive sign), and the temporary sine value Sin_Oct with a sign and the temporary cosine value c〇s_Oct are further output to the second selectors 605 and 607. The first selectors 601 and 603 individually select the temporary sine value Sin_Oct and the temporary cosine value Cos_0ct according to the control signals Invert_Swap[l] and Invert_Swap[2] outputted by the temporary sine/cosine value generator ι60. Value), or its complement value (negative value) of 2 as its output. On the other hand, the second selectors 6〇5 and 6〇7 are also selected based on the control signal Invert_SwaP[0]' outputted by the temporary sine/cosine generator 16〇 (1) the output value of the selector 6〇3 The final cosine value Cos - Val ' selector 6 〇 1 output value is the final sine value Sm - Val ' or (2) the output of the selector 6 〇 1 is the final cosine value Cos - Val ' selector 603 The turn is the final sine value sin_Val. The sinusoidal 7-sine-value generating device 100 of the present invention has been fully described herein, however, although the present invention has been disclosed above in the preferred embodiments, it is not intended to limit the scope of the present invention. In the spirit and scope of the invention, the scope of the invention is defined by the scope of the appended claims. 12 201032069 [Simplified description of the drawings] Fig. 1 shows a basic characteristic diagram of a sine/cosine function; Fig. 2 shows a block diagram of a sine/cosine value generating apparatus according to an embodiment of the present invention; A block diagram of a phase projector according to an embodiment of the invention; FIG. 4A shows an embodiment of a look-up table/arithmetic unit according to the present invention, which is implemented in a full look-up table method; ❹ Figure 4B shows Another embodiment of the look-up table/arithmetic unit according to the present invention is implemented in a fully arithmetic manner; FIG. 4C still shows another embodiment of the look-up table/arithmetic unit according to the present invention, which is Implemented in a table-arithmetic mixing method; FIG. 4D shows a data storage format in a read-only memory according to an embodiment of the invention, and FIG. 5A shows a temporary sine/in accordance with an embodiment of the invention. a process of generating a cosine value; ❹ Figure 5B shows a look-up table between the index of the index and the index of the octant according to an embodiment of the present invention; and Figure 6 shows the final form according to an embodiment of the present invention. / Cosine generation process. [Main component symbol description] 100 to sine/cosine value generating device 120 to phase projector 201032069 140 to look-up table/arithmetic unit 160 to temporary sine/cosine value generator 180 to sine/cosine value generator 301, 303~ Complementary digital generators 307, 501, 502, 601, 603, 605, 607 to selector 309 to logic circuits of units 305 to 2

311〜比較器 313〜及閘311~ Comparator 313~ and gate

Claims (1)

201032069 七、申請專利範圍: 1. 一種正弦/餘弦值產生裝置,用以產生一輸入相位的 正弦/餘弦值,包括: 一相位投射器,將上述輸入相位映射至介於八分圓之 内的一八分圓相位,並決定用以判斷上述輸入相位是否為 pi/4、3*pi/4、5*pi/4 或 7*pi/4 的一旗標; 一查表/算術單元,接收上述八分圓相位,並輸出對應 於上述八分圓相位的正弦/餘弦值; 參 一臨時正弦/餘弦值產生器,接收對應於上述八分圓相 位的正弦/餘弦值,以便根據上述旗標產生臨時正弦/餘弦 值;以及 一正弦/餘弦值產生器,根據用以顯示上述輸入相位所 在之八分圓位置的一八分圓索引,選擇性地將上述臨時正 弦/餘弦值做正弦/餘弦函數值的對調或改變正負號,以作為 上述輸入相位的正弦/餘弦值。 2. 如申請專利範圍第1項所述之正弦/餘弦值產生裝 ❿ 置,其中上述輸入相位介於0至2*pi,並且以N位元來表 示0 3. 如申請專利範圍第2項所述之正弦/餘弦值產生裝 置,其中上述相位投射器更決定上述八分圓索引。 4. 如申請專利範圍第3項所述之正弦/餘弦值產生裝 置,其中上述相位投射器更包括: 一第一擷取單元,取得上述輸入相位的前三個高位元 .作為上述八分圓索引.; 15 201032069201032069 VII. Patent application scope: 1. A sine/cosine value generating device for generating an input phase sine/cosine value, comprising: a phase projector for mapping the input phase to within an octant circle One-eighth round phase, and determine a flag used to determine whether the input phase is pi/4, 3*pi/4, 5*pi/4 or 7*pi/4; a look-up table/arithmetic unit, receive The above octant phase, and outputting a sine/cosine value corresponding to the octant phase; a temporary sine/cosine generator receiving a sine/cosine value corresponding to the octant phase to be based on the flag Generating a temporary sine/cosine value; and a sine/cosine generator selectively sinusoidal/cosine for the temporary sine/cosine value based on an octant index for displaying the octant position of the input phase The inverse of the function value or the sign is changed as the sine/cosine value of the above input phase. 2. The sine/cosine value generating device as described in claim 1, wherein the input phase is between 0 and 2*pi, and is represented by N bits. 3. For example, claim 2 The sine/cosine value generating device, wherein the phase projector further determines the octant index. 4. The sine/cosine value generating apparatus according to claim 3, wherein the phase projector further comprises: a first capturing unit that obtains the first three high bits of the input phase as the octant. Index.; 15 201032069 元 第二榻取單元,取得上述輸人相位的後从 3個低位 一 2的補數碼產生器,求出上述第 之N-3個低位元的補數; 選擇器,根據上述八分圓索引的低位 第二掘取單元所取得之抑個低位元,或=來選擇上述 產生器所求出之Ν-3個低位元的補數,迷2的補數碼 位,以及 卞為上述八分圓相 '掏取單元所取得 的低標上述,相位和上述八分刚 5. 如申請專利範圍第4 裝置’其中上述邏輯電路更包括 一比較器,判斷上述八分圓 邏輯0 ;以及 項所述之正弦/餘弦值產生 .· 相位的所有位元是否皆為 及閘 田上述八乂刀圓索引的低位元 述比較器判斷上述八分圓柏仿沾祕古/ -、邏輯1,且上 、 乩、刀圓相位的所有位元皆為邏輯〇 候,將上述旗標拉高至邏輯丨位準。 、 6.如申請專利範圍第1項所述之正弦/餘弦值產生 裝置,其中上述查表/算術單元更包括: 一唯讀記憶體,儲存第〇個八分圓的正弦/餘弦值,並 且輸出對應於上述八分圓相位的疋弦/餘弦值。 7. 如申請專利範圍第i頊所述之正弦/餘弦值產生 裝置,其中上述查表/算術單元更包拉. 一處理器,根據一正規化的相位,使用CORpiC疊代 演算法來輸出對應於上述八分圓相位的正弦/餘弦值,其中 201032069 上述正規化相位係根據先求得上述八分圓相位與pi/4相乘 後的結果值,再將該結果值切成κ俅元而求得。 8. 如申請專利範圍第1項所述之正弦/餘弦值產生 裝置’其中上述查表/算術單元更包拍. 一唯讀記憶體,儲存第0個八分圓的正弦/餘弦值,並 且輸出一正規化相位之第一部分的玉弦/餘弦值’其中上述 正規化相位係根據先求得上述八分圓相位與pi/4相乘後的 結果值’再將該結果值切成K位元而求得;以及a second second taking unit that obtains the complement of the first N-3 lower bits from the three lower-two complement digital generators after obtaining the input phase; the selector, according to the octant index The low bit obtained by the lower second boring unit, or = to select the complement of the Ν-3 lower bits obtained by the above generator, the complement of the numerator 2, and the 八 is the above octant The low level obtained by the phase capturing unit, the phase and the above eight points are just 5. The fourth device of the patent application range wherein the above logic circuit further includes a comparator for judging the above octant logic 0; The sine/cosine value is generated. · Whether all the bits of the phase are the lower bits of the above-mentioned eight-knife circle index of the brake field. The comparator judges that the above-mentioned eight-pointed round cypress imitation secrets the ancient / -, logic 1, and All bits of the 乩, knife circle phase are logical, and the above flag is raised to the logical 丨 level. 6. The sine/cosine value generating apparatus of claim 1, wherein the look-up table/arithmetic unit further comprises: a read-only memory storing a sine/cosine value of the eighth octant, and The chord/cosine value corresponding to the above octant phase is output. 7. The sine/cosine value generating apparatus according to the patent application scope, wherein the look-up table/arithmetic unit is further packaged. A processor, according to a normalized phase, uses a CORpiC iterative algorithm to output a corresponding The sine/cosine value of the above octant phase, wherein the normalized phase of 201032069 is based on the result value obtained by multiplying the octant phase and pi/4 first, and then cutting the result value into κ俅Seek. 8. The sine/cosine value generating device of claim 1, wherein the look-up table/arithmetic unit is more packaged. A read-only memory stores the sine/cosine value of the 0th octant, and Outputting a jade string/cosine value of a first portion of a normalized phase, wherein the normalized phase is based on a result value obtained by multiplying the octant phase by pi/4 first and then cutting the result value into K bits Seek from the yuan; and 一處理器,使用CORDIC疊代演算法產生上述正規化 相位之第二部分的正弦/餘弦值,並藉著合併上述正規化相 位之第一部分和第二部分的正弦/餘弦值來輸出對應於上 述八分圓相位的正弦/餘弦值。 、 裝 里 X τ印寻利靶圍第1項所述之正弦/餘弦值產生 ,其中上述臨時正弦/餘弦值產生器更包括: 分_位::做值或上述八 八㈣述常數值或上述 穿置10並::睛專利範圍第9項所述之正弦/餘弦值^ 臨時正弦/餘弦值產生器更包括 一查表表格,根掳μ 仿. 用以顯示對應於上述八八二分圓索引輸出-對調索引, 於下-級的上述正弦,餘弦值』餘弦值是否需要 的對調或·改變正負號的動作。&中’傲正弦/餘弦函數值 Π ·如申凊專利範圍裳7 圍第1項所述之正弦 201032069 裝置,其中上述正弦/餘弦值產生器更包括: 一第一級選擇器,根據上述八分圓索引選擇上述臨時 正弦/餘弦值,或上述臨時正弦/餘弦值之2的補數,做為上 述第一級選擇器的輸出;以及 一第二級選擇器,根據上述八分圓索引選擇上述第一 級選擇器的輸出做為上述輸入相位的正弦/餘弦值。 12.如申請專利範圍第10項所述之正弦/餘弦值產生 裝置,其中上述正弦/餘弦值產生器更包括·· φ 一第一級選擇器,根據上述對調索引的第二高位元, 選擇上述臨時正弦值或上述臨時正弦值之2的補數,以及 根據上述對調索引的高位元,選擇上述臨時餘弦值或上述 臨時餘弦值之2的補數,做為上述第一級選擇器的輸出; 以及 一第二級選擇器,根據上述對調索引的低位元,選擇 上述第一級選擇器的輸出作為上述輸入相位的正弦或餘弦a processor for generating a sine/cosine value of the second portion of the normalized phase using a CORDIC iterative algorithm, and outputting the sine/cosine values of the first and second portions of the normalized phase The sine/cosine value of the octant phase. The sine/cosine value described in item 1 of the X τ printing target is generated, wherein the temporary sine/cosine value generator further includes: a _ bit:: a value or a constant value of the above eight or eight (four) or The above-mentioned wearing 10 and the sine/cosine value described in item 9 of the patent range ^ temporary sine/cosine value generator further includes a look-up table, root 掳 μ imitation. Used to display corresponding to the above 832 Circular index output - the index of the offset, whether the above sine of the lower-level, cosine value of the cosine value is required to reverse or change the sign. The sinusoidal/cosine function value of the above-mentioned sine/cosine value generator, wherein the above-mentioned sine/cosine value generator further includes: a first-stage selector, according to the above The octant index selects the above temporary sine/cosine value, or the complement of the temporary sine/cosine value of 2, as the output of the first stage selector; and a second level selector according to the octant index The output of the first stage selector described above is selected as the sine/cosine value of the above input phase. 12. The sine/cosine value generating apparatus according to claim 10, wherein the sine/cosine value generator further comprises a φ-first level selector, and the second high-order element is selected according to the second index of the above-mentioned index. a temporary sine value or a complement of 2 of the temporary sine value, and a complement of the temporary cosine value or the tempo cosine value selected as the output of the first stage selector according to the high order element of the above-mentioned index And a second-stage selector for selecting the output of the first-stage selector as the sine or cosine of the input phase according to the low-order bit of the above-mentioned index
TW98104798A 2009-02-16 2009-02-16 Sine/cosine value generation apparatus TWI420325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW98104798A TWI420325B (en) 2009-02-16 2009-02-16 Sine/cosine value generation apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW98104798A TWI420325B (en) 2009-02-16 2009-02-16 Sine/cosine value generation apparatus

Publications (2)

Publication Number Publication Date
TW201032069A true TW201032069A (en) 2010-09-01
TWI420325B TWI420325B (en) 2013-12-21

Family

ID=44854767

Family Applications (1)

Application Number Title Priority Date Filing Date
TW98104798A TWI420325B (en) 2009-02-16 2009-02-16 Sine/cosine value generation apparatus

Country Status (1)

Country Link
TW (1) TWI420325B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5737253A (en) * 1995-08-30 1998-04-07 Pentomics, Inc. Method and apparatus for direct digital frequency synthesizer
US5774082A (en) * 1997-03-13 1998-06-30 Raytheon Company Digital phase to digital sine and cosine amplitude translator
US7031992B2 (en) * 2000-09-08 2006-04-18 Quartics, Inc. Hardware function generator support in a DSP
US20020145415A1 (en) * 2001-04-09 2002-10-10 Vanremmen William John Method and apparatus for determining the instantaneous power of a sinusoidal signal
JP4268525B2 (en) * 2002-03-22 2009-05-27 旭化成エレクトロニクス株式会社 Angle detection device and angle detection system

Also Published As

Publication number Publication date
TWI420325B (en) 2013-12-21

Similar Documents

Publication Publication Date Title
JPH10210094A (en) Method for generating sine/cosine function in digital signal processing system and device therefor
JP5086428B2 (en) Circuit and method for dynamically selecting circuit elements
JPH05292135A (en) Digital modulator
US8392492B2 (en) Sine/cosine value generation apparatus
TW201032069A (en) Sine/cosine value generation apparatus
TW202018597A (en) Apparatus of implementing activation logic for neural network and method thereof
CN107943204B (en) Digital frequency synthesis method and device
JP2007209192A (en) Motor drive circuit using discrete time oscillator, and method therefor
TWI269222B (en) Random number generating method and its equipment with a multiple polynomial
JP3015011B1 (en) Sine / cosine operation circuit
WO2004088586A1 (en) Lookup table device and image generation device
JP2004172794A (en) Composite trigonometric function computing element and phase rotation computing element
US6470366B1 (en) Angle calculation circuit
CN110908633A (en) Coordinate rotation digital calculator and method
JP3962298B2 (en) CPFSK signal generation circuit and CPFSK signal generation method
WO2015120706A1 (en) Device and method for generating sine wave
Huang et al. FPGA Implementation of a Novel Type DDS Based on CORDIC Algorithm
JP2009089343A (en) Angle computation method, and associated circuit
JP2815342B2 (en) Orthogonal function generator
JP2822577B2 (en) Square root arithmetic unit
JP2598851Y2 (en) π / 4DQPSK encoder
TW200525423A (en) Joint adaptive fixed-point representation and related arithmetic and processor thereof
TW202020655A (en) Coordinate rotation digital computing device and method using the same
JP3390599B2 (en) Divider
TW202011176A (en) Coordinate rotation digital computer and method using the same

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees