TWI394043B - Method of handling successive bitstream extraction and packing and related device - Google Patents
Method of handling successive bitstream extraction and packing and related device Download PDFInfo
- Publication number
- TWI394043B TWI394043B TW97148208A TW97148208A TWI394043B TW I394043 B TWI394043 B TW I394043B TW 97148208 A TW97148208 A TW 97148208A TW 97148208 A TW97148208 A TW 97148208A TW I394043 B TWI394043 B TW I394043B
- Authority
- TW
- Taiwan
- Prior art keywords
- predetermined
- register
- bit
- length
- bits
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims description 64
- 238000012856 packing Methods 0.000 title claims description 9
- 238000000605 extraction Methods 0.000 title description 5
- 238000004806 packaging method and process Methods 0.000 claims description 38
- 239000000872 buffer Substances 0.000 claims description 36
- 238000012545 processing Methods 0.000 claims description 7
- 239000012536 storage buffer Substances 0.000 description 19
- 238000010586 diagram Methods 0.000 description 7
- 238000013481 data capture Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012858 packaging process Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Description
本發明相關於一種處理位元資料流之方法及相關裝置,尤指一種有效擷取和包裝位元資料流之方法及相關裝置。The invention relates to a method and a related device for processing a bit data stream, in particular to a method and a related device for efficiently extracting and packaging a bit data stream.
位元資料流(bitstream)可被應用於許多不同種類的領域,例如多媒體檔案串流(multimedia file streaming)或網路串流(network streaming)。位元資料流的傳統操作包含擷取(extraction)和包裝(packing)。舉例來說,位元資料流擷取可用來播放一串流聲音檔案,而位元資料流包裝可用來編碼串流聲音檔案。Bitstreams can be applied to many different kinds of fields, such as multimedia file streaming or network streaming. Traditional operations of bitstreams include extraction and packing. For example, bitstream stream capture can be used to play a stream of sound files, and bitstream stream wrappers can be used to encode streaming sound files.
若要從一記憶體內之一位元資料流中連續地擷取位元,需要依據擷取條件來執行一系列的操作/指令。欲擷取之位元係儲存於一位元資料流儲存暫存器(bitstream storage register,BSR),擷取後之位元則儲存於一目標暫存器(destination register,DR)。一旦位元資料流儲存暫存器BSR中所有位元已被擷取,記憶體將會將新的位元(例如32個位元)寫入位元資料流儲存暫存器BSR內騰空的空間。位置暫存器(position register)內存之起始位置(starting position,SP)標示出位元擷取之開始點,而長度暫存器(length register)內存之擷取長度(length of extraction,LE)則標示出從BSR所擷取出的位元數目。舉例來說,起始位置SP之值可介於1~32,而擷取長度LE之值可介於1~32。依據起始位置SP和擷取長度LE之間的大小關係,會有出現三種不同情形:”SP>LE”、”SP=LE”和“SP<LE”。To continuously retrieve a bit from a bit stream in a memory, a series of operations/instructions need to be performed in accordance with the fetch conditions. The bits to be retrieved are stored in a bitstream storage register (BSR), and the retrieved bits are stored in a destination register (DR). Once all the bits in the bit stream storage buffer BSR have been retrieved, the memory will write the new bit (eg 32 bits) into the space vacated in the bit stream storage buffer BSR. . The position of the position register memory (starting position, SP) indicates the starting point of the bit extraction, and the length register of the length register (length of extraction, LE) Then the number of bits extracted from the BSR is indicated. For example, the value of the starting position SP may be between 1 and 32, and the value of the drawing length LE may be between 1 and 32. According to the relationship between the starting position SP and the capturing length LE, there are three different situations: "SP>LE", "SP=LE" and "SP<LE".
第13圖說明了先前技術在第一種情形”SP>LE”時擷取位元之方式。當起始位置SP大於擷取長度LE時,此時位元資料流儲存暫存器BSR內包含所有欲擷取之位元,且在擷取後位元資料流儲存暫存器BSR內仍存有未擷取之位元。在此種情形下,位元資料流儲存暫存器BSR會被向左平移(32-SP)個位元,並將過程中結果暫時存入目標暫存器DR。接著,目標暫存器DR內存之過程中結果會被向右平移(32-LE)個位元,並將最終擷取結果寫入目標暫存器DR。最後,位置暫存器之值會被更新為起始位置SP減去擷取長度LE之值(SP-LE)。第13圖所示之範例指令程序1300說明了在”SP>LE”時之運作情形。Figure 13 illustrates the manner in which the prior art retrieved bits in the first case "SP > LE". When the starting position SP is greater than the capturing length LE, the bit stream storage buffer BSR contains all the bits to be retrieved, and remains in the bit stream storage buffer BSR after the retrieval. There are untaken bits. In this case, the bit stream storage scratchpad BSR is translated (32-SP) bits to the left, and the in-process results are temporarily stored in the target register DR. Then, the result of the target scratchpad DR memory is shifted to the right (32-LE) bits, and the final captured result is written to the target register DR. Finally, the value of the location register is updated to the starting position SP minus the value of the retrieval length LE (SP-LE). The example instruction program 1300 shown in Fig. 13 illustrates the operation at "SP>LE".
第14圖說明了先前技術在第二種情形”SP=LE”時擷取位元之方式。當起始位置SP等於擷取長度LE時,此時位元資料流儲存暫存器BSR內包含所有欲擷取之位元,且在擷取後位元資料流儲存暫存器BSR內並無其它未擷取之位元資料。在此種情形下,位元資料流儲存暫存器BSR會被向左平移(32-SP)個位元,並將過程中結果暫時存入目標暫存器DR。接著,目標暫存器DR內存之過程中結果會被向右平移(32-SP)個位元,並將最終結果寫入目標暫存器DR。同時,位置暫存器之值會被更新至32。由於位元資料流儲存暫存器BSR內之位元已全部被擷取,記憶體將會將新的32個位元寫入位元資料流儲存暫存器BSR。第14圖所示之範例指令程序1400在”SP=LE”時之運作情形。Figure 14 illustrates the manner in which the prior art retrieved bits in the second case "SP = LE". When the starting position SP is equal to the capturing length LE, the bit stream storage buffer BSR contains all the bits to be retrieved, and there is no bit in the bit stream storage register BSR after the retrieval. Other untaken bit data. In this case, the bit stream storage scratchpad BSR is translated (32-SP) bits to the left, and the in-process results are temporarily stored in the target register DR. Then, the result of the target scratchpad DR memory is shifted to the right (32-SP) bits, and the final result is written to the target register DR. At the same time, the value of the location register will be updated to 32. Since all the bits in the bit stream storage buffer BSR have been retrieved, the memory will write the new 32 bits into the bit stream storage buffer BSR. The operation of the example instruction program 1400 shown in Fig. 14 at "SP = LE".
第15圖說明了先前技術在第三種情形”SP<LE”時擷取位元之方式。當起始位置SP小於擷取長度LE時,此時位元資料流儲存暫存器BSR內並未包含所有欲擷取之位元。此種邊界條件稱為「資料欠位」(underflow)。在此種情形下,位元資料流儲存暫存器BSR會被向左平移(32-SP)個位元,並將過程中結果暫時存入目標暫存器DR。接著,目標暫存器DR內存之過程中結果會被平移(32-LE)個位元,並將新的過程中結果暫時存入目標暫存器DR。同時,位置暫存器之值會被更新至32,而位置暫存器之值會被更新為擷取長度LE減去起始位置SP之值(LE-SP)。由於暫存器BSR內之位元已全部被擷取,記憶體將會將新的32個位元寫入位元資料流儲存暫存器BSR內。接著,剩餘的位元會被擷取至一臨時暫存器TR。在對目標暫存器DR和臨時暫存器TR內存之資料執行邏輯或(logic OR)運算後,最終擷取結果會被寫入目標暫存器DR。第15圖所示之範例指示程序1500說明了在”SP<LE”時之運作情形。Figure 15 illustrates the manner in which the prior art retrieved bits in the third scenario "SP < LE". When the starting position SP is smaller than the capturing length LE, the bit stream storage buffer BSR does not include all the bits to be captured. This boundary condition is called "underflow". In this case, the bit stream storage scratchpad BSR is translated (32-SP) bits to the left, and the in-process results are temporarily stored in the target register DR. Next, the result of the target scratchpad DR memory is translated (32-LE) bits and the new in-process result is temporarily stored in the target register DR. At the same time, the value of the location register is updated to 32, and the value of the location register is updated to the length of the capture LE minus the value of the start position SP (LE-SP). Since the bits in the scratchpad BSR have all been fetched, the memory will write the new 32 bits into the bit stream storage scratchpad BSR. Then, the remaining bits are captured to a temporary register TR. After performing a logical OR (logic OR) operation on the data of the target scratchpad DR and the temporary scratchpad TR memory, the final captured result is written to the target register DR. The example indicating program 1500 shown in Fig. 15 illustrates the operation at "SP < LE".
若要將位元連續地包裝至一記憶體內之一位元資料流中,需要依據包裝條件來執行一系列的操作/指令。一來源暫存器(source register,SR)之包裝資料係紀錄於一位元資料流儲存暫存器BSR,當位元資料流儲存暫存器BSR之空間已滿,位元資料流儲存暫存器BSR其內存資料會被存入記憶體內。位置暫存器(position register)內存有一起始位置SP,而長度暫存器內存有一包裝長度(length of packing,LE)。舉例來說,起始位置SP之值可介於1~32,而包裝長度LE之值可介於1~32。依據起始位置SP和包裝長度LE之間的大小關係,會有出現三種不同情形:”SP>LE”、”SP=LE”和“SP<LE”。To continuously wrap a bit into a bit stream in a memory, a series of operations/instructions need to be performed depending on the packaging conditions. The packaging data of a source register (SR) is recorded in a metadata stream storage register BSR. When the space of the bit stream storage buffer BSR is full, the bit stream is temporarily stored. The memory data of the BSR will be stored in the memory. The position register memory has a starting position SP, and the length register memory has a length of packing (LE). For example, the value of the starting position SP may be between 1 and 32, and the value of the package length LE may be between 1 and 32. According to the relationship between the starting position SP and the package length LE, there are three different situations: "SP>LE", "SP=LE" and "SP<LE".
第16圖說明了先前技術在第一種情形”SP>LE”時包裝位元之方式。當起始位置SP大於包裝長度LE時,此時位元資料流儲存暫存器BSR內可包含所有欲包裝之位元,且在包裝後位元資料流儲存暫存器BSR內仍可包裝其它更多位元。在此種情形下,來源暫存器SR會被向左平移(SP-LE)個位元,並將過程中結果暫時存入來源暫存器SR。接著,在對位元資料流儲存暫存器BSR和來源暫存器SR內存之資料執行邏輯或運算後,最終包裝結果會被寫入位元資料流儲存暫存器BSR。另一方面,位置暫存器之值會被更新為起始位置SP減去包裝長度LE之值(SP-LE)。第16圖所示之範例指令程序1600說明了在”SP>LE”時之運作情形。Figure 16 illustrates the manner in which the prior art wraps the bit in the first case "SP > LE". When the starting position SP is greater than the package length LE, the bit stream storage buffer BSR may include all the bits to be packaged, and the packaged bit stream may still be packaged in the bit stream storage buffer BSR. More bits. In this case, the source register SR is shifted to the left (SP-LE) bits and the in-process results are temporarily stored in the source register SR. Then, after performing a logical OR operation on the data of the bit stream storage buffer BSR and the source register SR memory, the final package result is written into the bit stream storage register BSR. On the other hand, the value of the location register is updated to the starting position SP minus the value of the package length LE (SP-LE). The example instruction program 1600 shown in Fig. 16 illustrates the operation at "SP>LE".
第17圖說明了先前技術在第二種情形”SP=LE”時包裝位元之方式。當起始位置SP等於包裝長度LE時,此時位元資料流儲存暫存器BSR內可包含所有欲包裝之位元,而且在包裝後位元資料流儲存暫存器BSR內並無多出的位置可以再包裝。在此種情形下,首先對位元資料流儲存暫存器BSR和來源暫存器SR內存之資料執行邏輯或運算後,再將最終包裝結果寫入位元資料流儲存暫存器BSR。另一方面,位置暫存器之值會被更新至32。在將位元資料流儲存暫存器BSR之資料存入記憶體後,位元資料流儲存暫存器BSR之值會被更新為0以為後續包裝作準備。第17圖所示之範例指示程序1700說明了在”SP=LE”時之運作情形。Figure 17 illustrates the manner in which the prior art wraps the bit in the second case "SP = LE". When the starting position SP is equal to the package length LE, the bit stream storage buffer BSR may include all the bits to be packaged, and there is not much in the bit stream storage buffer BSR after packaging. The location can be repackaged. In this case, first perform a logical OR operation on the data of the bit stream storage buffer BSR and the source register SR memory, and then write the final package result into the bit stream storage register BSR. On the other hand, the value of the location register is updated to 32. After the data of the bit stream storage buffer BSR is stored in the memory, the value of the bit stream storage register BSR is updated to 0 to prepare for subsequent packaging. The example indicating program 1700 shown in Fig. 17 illustrates the operation at "SP=LE".
第18圖說明了先前技術在第三種情形”SP<LE”時包裝位元之方式。當起始位置SP小於包裝長度LE時,此時位元資料流儲存暫存器BSR內並未有足夠的空間可以包含所有欲包裝之位元,因此包裝過程需要分成兩階段來進行,此種邊界條件稱為「資料溢位」(overflow)。在此種情形下,來源暫存器SR會被向右平移(LE-SP)個位元,並將過程中結果暫時存入一臨時暫存器(temporary register,TR)。接著對位元資料流儲存暫存器BSR和臨時暫存器TR內存之資料執行邏輯或運算後,再將最終結果寫入位元資料流儲存暫存器BSR。在位元資料流儲存暫存器BSR之資料被存入記憶體後,來源暫存器SR會被向右平移(32-LE+SP)個位元,再將最終結果寫入位元資料流儲存暫存器BSR。另一方面,位置暫存器之值會被更新至(32-LE+SP)。第18圖所示之範例指令程序1800說明了在”SP<LE”時之運作情形。Figure 18 illustrates the manner in which the prior art wraps the bit in the third scenario "SP < LE". When the starting position SP is smaller than the package length LE, there is not enough space in the bit stream storage register BSR to contain all the bits to be packaged, so the packaging process needs to be carried out in two stages. The boundary condition is called "overflow". In this case, the source register SR is translated to the right (LE-SP) bits and the result of the process is temporarily stored in a temporary register (TR). Then, after performing a logical OR operation on the data of the bit stream storage buffer BSR and the temporary register TR memory, the final result is written into the bit stream storage buffer BSR. After the data of the bit stream storage buffer BSR is stored in the memory, the source register SR is translated to the right (32-LE+SP) bits, and the final result is written into the bit stream. Store the scratchpad BSR. On the other hand, the value of the location register is updated to (32-LE+SP). The example instruction program 1800 shown in Fig. 18 illustrates the operation of "SP<LE".
如第8圖所示,一MIPS DSP特定應用延伸技術提供從一64位元之暫存器內擷取1~32個位元之指令,但卻未提供當擷取資料之位元數超過64位元時之處理方式。另一方面,美國專利號7,334,116 B2(在後述內容簡稱為116前案)使用一64位元之緩衝器和個別左向/右向平移的操作,以從一記憶體內之一位元資料流中擷取一特定數目之位元。然而,116前案無法有效地處理「資料欠位」和「資料溢位」等邊界條件,而且緩衝器之位元長度需要大於記憶體之位置邊界長度。先前技術無法有效地處理位元資料流擷取/包裝之「資料欠位」和「資料溢位」等邊界條件,因此會降低系統效率。As shown in Figure 8, a MIPS DSP-specific application extension technique provides instructions for fetching 1 to 32 bits from a 64-bit scratchpad, but does not provide a bit number of more than 64 bits when the data is retrieved. The processing method of the bit time. On the other hand, U.S. Patent No. 7,334,116 B2 (hereinafter referred to as "previously referred to as 116") uses a 64-bit buffer and individual left/right translation operations to stream from one bit of a memory. Take a specific number of bits. However, the pre-116 case cannot effectively handle boundary conditions such as "data under-subscription" and "data overflow", and the bit length of the buffer needs to be larger than the position boundary length of the memory. The prior art cannot effectively handle boundary conditions such as "data underrun" and "data overflow" of the bit stream/capture, which reduces system efficiency.
本發明提供一種從一位元資料流暫存器中擷取位元之方法,其包含當一預定起始位置大於一預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取一預定數目之位元,其中該預定數目和該預定擷取長度具相同值;將該些位元存入一目標暫存器內之一最低位元部分;當未資料欠位時,將該目標暫存器內未儲存位元之一高位元部分設為一預定值;清除一空旗標及一資料欠位旗標之設定;以及使用該預定起始位置減去該預定數目之值來更新該預定起始位置。The present invention provides a method for extracting a bit from a bit stream buffer, comprising: when the predetermined start position is greater than a predetermined draw length, the predetermined order from the bit stream register The starting position begins to capture a predetermined number of bits, wherein the predetermined number and the predetermined drawing length have the same value; the bits are stored in a lowest bit portion of a target register; when no data In the case of an under-position, setting a high-order portion of one of the un-stored bits in the target register to a predetermined value; clearing an empty flag and a data under-flag setting; and subtracting the predetermined starting position A predetermined number of values to update the predetermined starting position.
本發明另提供一種從一位元資料流暫存器中擷取位元之方法,其包含當一預定起始位置等於一預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取一預定數目之位元,其中該預定數目和該預定擷取長度具相同值;將該些位元存入一目標暫存器內之一最低位元部分;當未資料欠位時,將該目標暫存器內未儲存位元之一高位元部分設為一預定值;設定一空旗標以標示該位元資料流暫存器內所有位元資料已被擷取,並清除一資料欠位旗標;以及將該預定起始位置更新為該位元資料流暫存器內之一預定位元以為下次擷取作準備。The present invention further provides a method for extracting a bit from a bit stream buffer, comprising: when a predetermined start position is equal to a predetermined draw length, from the bit stream register Determining a starting position to obtain a predetermined number of bits, wherein the predetermined number and the predetermined drawing length have the same value; storing the bits in a lowest bit portion of a target register; When the data is under-subscribed, the high-order part of one of the un-stored bits in the target register is set to a predetermined value; an empty flag is set to indicate that all the bit data in the bit stream register has been captured. And clearing a data underrun flag; and updating the predetermined starting location to a predetermined bit in the bit stream register to prepare for the next acquisition.
本發明另提供一種從一位元資料流暫存器中擷取位元之方法,其包含當一預定起始位置小於一預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取一預定數目之位元,其中該預定數目和該預定起始位置具相同值;在從該位元資料流暫存器中所擷取之該些位元後加入一預定數目之複數個緩衝位元以增加至該預定擷取長度之位元數;從和該預定擷取長度相同之一位置開始,將該些位元存入一目標暫存器內之一最低位元部分;當一資料欠位旗標未被設定時,將該目標暫存器內未儲存位元之一高位元部分設為一預定值;將該預定起始位置更新為該位元資料流暫存器內之一預定位元以為下次擷取作準備;使用該預定擷取長度減去該預定起始位置之值來更新該預定擷取長度;以及設定該資料欠位旗標和一空旗標。The present invention further provides a method for extracting a bit from a bit stream buffer, comprising: when a predetermined starting position is less than a predetermined draw length, from the bit stream register Determining a starting position to start capturing a predetermined number of bits, wherein the predetermined number and the predetermined starting position have the same value; adding one after the bits extracted from the bit stream register a predetermined number of buffer bits to increase the number of bits to the predetermined capture length; starting from a position that is the same as the predetermined capture length, storing the bits in a target temporary register a bit portion; when a data under-count flag is not set, setting a high-order portion of one of the un-stored bits in the target register to a predetermined value; updating the predetermined starting position to the bit data Predetermining a bit in the stream register to prepare for the next capture; updating the predetermined draw length by using the predetermined draw length minus the predetermined start position; and setting the data under flag and An empty flag.
本發明另提供一種從一位元資料流暫存器中擷取位元之方法,其包含當一資料欠位旗標已被設定時,從該位元資料流暫存器中之一最大有效位元開始擷取一預定數目之位元,其中該預定數目之值等於前次擷取該先前預定擷取長度減去一先前起始位置之值;將該些位元存入一目標暫存器內之一最低位元部分;以及清除該資料欠位旗標及一空旗標之設定。The present invention further provides a method for extracting a bit from a bit stream buffer, which includes one of the most effective ones from the bit stream register when a data under flag has been set. The bit begins to retrieve a predetermined number of bits, wherein the predetermined number of values is equal to the previous value of the previous predetermined draw length minus a previous start position; storing the bits in a target temporary storage One of the lowest bit parts in the device; and the setting of clearing the data under-counter flag and an empty flag.
本發明另提供一種從一位元資料流暫存器中擷取位元之方法,其包含當一預定起始位置大於一預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取一預定數目之位元,其中該預定數目和該預定擷取長度具相同值;將該些位元存入一目標暫存器內之一最低位元部分;當未資料欠位時,將該目標暫存器內未儲存位元之一高位元部分設為一預定值;清除一空旗標及一資料欠位旗標之設定;使用該預定起始位置減去該預定數目之值來更新該預定起始位置;當該預定起始位置等於該預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取該預定數目之位元,其中該預定數目和該預定擷取長度具相同值;將該些位元存入該目標暫存器內之該最低位元部分;當未資料欠位時,將該目標暫存器內未儲存位元之該高位元部分設為該預定值;設定一空旗標以標示該位元資料流暫存器內所有位元資料已被擷取,並清除一資料欠位旗標;將該預定起始位置更新為該位元資料流暫存器內之一預定位元以為下次擷取作準備;當該預定起始位置小於該預定擷取長度時,從該位元資料流暫存器中之該預定起始位置開始擷取一預定數目之位元,其中該預定數目和該預定起始位置具相同值;在從該位元資料流暫存器中所擷取之該些位元後加入一預定數目之複數個緩衝位元以增加至該預定擷取長度之位元數;從和該預定擷取長度相同之一位置開始,將該些位元存入該目標暫存器內之該最低位元部分;當一資料欠位旗標未被設定時,將該目標暫存器內未儲存位元之該高位元部分設為該預定值;將該預定起始位置更新為該位元資料流暫存器內之該預定位元以為下次擷取作準備;使用該預定擷取長度減去該預定起始位置之值來更新該預定擷取長度;設定一空旗標以及該資料欠位旗標;當該資料欠位旗標已被設定時,從該位元資料流暫存器中之一最大有效位元開始擷取該預定數目之位元,其中該預定數目之值等於前次擷取該先前預定擷取減去一先前起始位置之值;將該些位元存入該目標暫存器內之該最低位元部分;以及清除該資料欠位旗標及一空旗標之設定。The present invention further provides a method for extracting a bit from a bit stream buffer, comprising: when a predetermined start position is greater than a predetermined draw length, from the bit stream register Determining a starting position to obtain a predetermined number of bits, wherein the predetermined number and the predetermined drawing length have the same value; storing the bits in a lowest bit portion of a target register; When the data is under-subscribed, the high-order portion of one of the un-stored bits in the target register is set to a predetermined value; the setting of an empty flag and a data under-flag is cleared; and the predetermined starting position is used to subtract the a predetermined number of values to update the predetermined starting position; when the predetermined starting position is equal to the predetermined drawn length, the predetermined number of bits is taken from the predetermined starting position in the bit stream register a unit, wherein the predetermined number and the predetermined draw length have the same value; the bits are stored in the lowest bit portion of the target register; when no data is under-ordered, the target register is The high-order portion of the unstored bit is set to the predetermined Setting an empty flag to indicate that all the bit data in the bit stream buffer has been retrieved, and clearing a data under flag; updating the predetermined starting position to the bit stream register One of the predetermined bits is prepared for the next capture; when the predetermined start position is less than the predetermined draw length, a predetermined number is taken from the predetermined start position in the bit stream register a bit, wherein the predetermined number and the predetermined starting position have the same value; adding a predetermined number of buffer bits after adding the bits from the bit stream register to increase a number of bits up to the predetermined length; starting from a position that is the same as the predetermined length, storing the bits in the lowest bit portion of the target register; when a data is under banner When the target is not set, the high-order portion of the unstored bit in the target register is set to the predetermined value; and the predetermined starting position is updated to the predetermined bit in the bit stream register In order to prepare for the next capture; use the predetermined draw length minus The predetermined starting position value is updated to update the predetermined drawing length; an empty flag and the data under-counting flag are set; when the data under-authing flag has been set, one of the bit stream registers is The most significant bit begins to retrieve the predetermined number of bits, wherein the predetermined number of values is equal to the previous value of the previous predetermined acquisition minus a previous starting position; the bits are stored in the target The lowest bit portion in the memory; and the setting of clearing the data under-flag and an empty flag.
本發明另提供一種將位元包裝至一位元資料流暫存器內之方法,其包含當一預定起始位置大於一預定包裝長度時,從一來源暫存器之一最低位元部分開始包裝一預定數目之位元,其中該預定數目和該預定包裝長度具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;清除一滿旗標和一資料溢位旗標;以及使用該預定起始位置減去該預定包裝長度之值來更新該預定起始位置。The present invention further provides a method of packaging a bit into a one-bit data stream register, comprising: starting from a lowest bit portion of one of the source registers when a predetermined starting position is greater than a predetermined package length Packaging a predetermined number of bits, wherein the predetermined number and the predetermined package length have the same value; starting from the predetermined starting position, storing the bits in the bit stream register; clearing a full flag And a data overflow flag; and updating the predetermined starting position by using the predetermined starting position minus the value of the predetermined package length.
本發明另提供一種將位元包裝至一位元資料流暫存器內之方法,其包含當一預定起始位置等於一預定包裝長度時,從一來源暫存器之一最低位元部分開始包裝一預定數目之位元,其中該預定數目和該預定包裝長度具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;設定一滿旗標以及清除一資料溢位旗標;以及將該預定起始位置更新為該位元資料流暫存器之一最大有效位元。The present invention further provides a method of packaging a bit into a one-bit data stream register, comprising: starting from a lowest bit portion of one of the source registers when a predetermined starting position is equal to a predetermined package length Packaging a predetermined number of bits, wherein the predetermined number and the predetermined package length have the same value; from the predetermined starting position, the bits are stored in the bit stream register; setting a full flag And clearing a data overflow flag; and updating the predetermined starting position to one of the most significant bits of the bit stream register.
本發明另提供一種將位元包裝至一位元資料流暫存器內之方法,其包含當一預定起始位置小於一預定包裝長度時,從一來源暫存器之一最低位元部分開始包裝一預定數目之位元,其中該預定數目和該預定起始位置具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;設定一滿旗標和一資料溢位旗標;將該預定起始位置更新為該位元資料流暫存器之一最大有效位元;以及使用該預定包裝長度減去該預定起始位置之值來更新該預定包裝長度。The present invention further provides a method of packaging a bit into a one-bit data stream register, comprising: starting from a lowest bit portion of one of the source registers when a predetermined starting position is less than a predetermined package length Packaging a predetermined number of bits, wherein the predetermined number and the predetermined starting position have the same value; starting from the predetermined starting position, storing the bits in the bit stream register; setting a full a flag and a data overflow flag; updating the predetermined starting position to one of the most significant bits of the bit stream register; and updating the value by using the predetermined package length minus the predetermined starting position The predetermined package length.
本發明另提供一種將位元包裝至一位元資料流暫存器內之方法,其包含當一預定起始位置大於一預定包裝長度時,從一來源暫存器之一最低位元部分開始包裝一預定數目之位元,其中該預定數目和該預定包裝長度具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;清除一滿旗標和一資料溢位旗標;使用該預定起始位置減去該預定包裝長度之值來更新該預定起始位置;當該預定起始位置等於該預定包裝長度時,從該來源暫存器之一最低位元部分開始包裝該預定數目之位元,其中該預定數目和該預定包裝長度具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;設定該滿旗標以及清除該資料溢位旗標;將該預定起始位置更新為該位元資料流暫存器之一最大有效位元;當該預定起始位置小於該預定包裝長度時,從該來源暫存器之該最低位元部分開始包裝該預定數目之位元,其中該預定數目和該預定起始位置具相同值;從該預定起始位置開始,將該些位元存入該位元資料流暫存器內;設定該滿旗標和該資料溢位旗標;將該預定起始位置更新為該位元資料流暫存器之該最大有效位元;以及使用該預定包裝長度減去該預定起始位置之值來更新該預定包裝長度。The present invention further provides a method of packaging a bit into a one-bit data stream register, comprising: starting from a lowest bit portion of one of the source registers when a predetermined starting position is greater than a predetermined package length Packaging a predetermined number of bits, wherein the predetermined number and the predetermined package length have the same value; starting from the predetermined starting position, storing the bits in the bit stream register; clearing a full flag And a data overflow flag; updating the predetermined starting position by subtracting the predetermined starting position from the predetermined starting position; and when the predetermined starting position is equal to the predetermined package length, from the source register One of the lowest bit portions begins to package the predetermined number of bits, wherein the predetermined number and the predetermined package length have the same value; from the predetermined starting position, the bits are stored in the bit stream temporary Setting the full flag and clearing the data overflow flag; updating the predetermined starting position to one of the most significant bits of the bit stream register; when the predetermined starting position is less than the predetermined package length Decapsulating the predetermined number of bits from the lowest bit portion of the source register, wherein the predetermined number and the predetermined starting position have the same value; starting from the predetermined starting position, storing the bits Entering the bit stream register; setting the full flag and the data overflow flag; updating the predetermined starting position to the most significant bit of the bit stream register; and using the The predetermined package length is updated by subtracting the predetermined package start value from the predetermined package length.
本發明另提供一種位元資料流擷取裝置,其包含一位元資料流暫存器,用來儲存擷取資料;一移位器,會依據一差異結果來對從該位元資料流暫存器擷取出之資料進行移位處理;一目標暫存器,用來儲存被該移位器移位後之資料;一起始位置暫存器,用來儲存一起始位置;一擷取長度暫存器,用來儲存一擷取長度;一運算邏輯單元,用來比較該起始位置和該擷取長度以產生一比較結果,以及用來依據該起始位置和該擷取長度來產生該差異結果;以及一控制邏輯,用來依據該比較結果來更新該起始位置、更新該擷取長度,以及控制該移位器之左向/右向移位方向。The invention further provides a bit data stream capture device, which comprises a one-bit data stream register for storing data; a shifter will temporarily stream from the bit data according to a difference result. The data retrieved by the memory is subjected to shift processing; a target register is used to store the data shifted by the shifter; a start position register is used to store a starting position; a memory for storing a length of the capture; an arithmetic logic unit for comparing the start position and the length of the capture to generate a comparison result, and for generating the basis according to the start position and the length of the capture a difference result; and a control logic for updating the starting position, updating the captured length, and controlling a left/right shifting direction of the shifter based on the comparison result.
本發明另提供一種位元資料流包裝裝置,其包含一來源暫存器,用來儲存包裝資料;一移位器,會依據一差異結果來對從該來源暫存器包裝出之資料進行移位處理;一位元資料流暫存器,用來儲存被該移位器移位後之資料;一起始位置暫存器,用來儲存一起始位置;一包裝長度暫存器,用來儲存一包裝長度;一運算邏輯單元,用來比較該起始位置和該包裝長度以產生一比較結果,以及用來依據該起始位置和該包裝長度來產生該差異結果;以及一控制邏輯,用來依據該比較結果來更新該包裝長度、更新該起始位置,以及控制該移位器之左向/右向移位方向。The present invention further provides a bit data stream packaging device, comprising a source register for storing package data; a shifter for moving data packaged from the source register according to a difference result Bit processing; a meta data stream register for storing data shifted by the shifter; a start position register for storing a starting position; a package length register for storing a package length; an arithmetic logic unit for comparing the starting position and the length of the package to produce a comparison result, and for generating the difference result according to the starting position and the length of the package; and a control logic for The package length is updated according to the comparison result, the start position is updated, and the left/right shift direction of the shifter is controlled.
第1~4圖和第9圖說明了本發明第一實施例中從一位元資料流暫存器(BSR)Ra中擷取位元之方法。如第1~4圖所示,位元資料流暫存器Ra可包含32個位元,如0~31。位元資料流暫存器Ra之位元可被擷取且儲存至一目標暫存器(DR)Rt。一結構暫存器(configuration register)Rb可將一預定擷取長度(LE)存入Rb(4,0)、將一預定起始位置(SP)存入Rb(9,5)、將一空旗標(empty flag)存入Rb(13),以及將一資料欠位旗標(underflow flag)存入Rb(31)。當然,預定擷取長度LE、預定起始位置SP、空旗標和資料欠位旗標可存入結構暫存器Rb內其它位置,甚至存入其它暫存器。第9圖之流程圖說明了本發明第一實施例中從一位元資料流暫存器Ra中擷取位元之方法。Figs. 1 to 4 and Fig. 9 illustrate a method of extracting bits from a bit stream stream register (BSR) Ra in the first embodiment of the present invention. As shown in FIGS. 1 to 4, the bit stream register scratcher Ra may include 32 bits, such as 0 to 31. The bit of the bit stream register scratcher Ra can be retrieved and stored to a target register (DR) Rt. A configuration register Rb can store a predetermined draw length (LE) in Rb (4, 0), a predetermined starting position (SP) into Rb (9, 5), and an empty flag. The empty flag is stored in Rb (13), and an underflow flag is stored in Rb (31). Of course, the predetermined retrieval length LE, the predetermined starting position SP, the empty flag and the data under-counting flag can be stored in other locations in the structure register Rb, and even stored in other registers. The flowchart of Fig. 9 illustrates a method of extracting bits from the one-bit data stream register Ra in the first embodiment of the present invention.
在第9圖中,若起始位置SP大於擷取長度LE,會從位元資料流暫存器Ra中擷取LE個位元至目標暫存器Rt。SP>LE時擷取位元之過程如第1圖所示,從位元資料流暫存器Ra中擷取出的LE個位元(例如BSR(SP-1,SP-LE))會被存入目標暫存器Rt之最低位元部分(例如DR(LE-1,0))。由於起始位置SP大於擷取長度LE,擷取後位元資料流暫存器Ra內仍存有一些位元,因此不會造成「資料欠位」的情形。此時,目標暫存器Rt之較高位元部分(例如DR(31,LE))會依資料欠位旗標之初始設定寫入一預定值(例如0)或維持不變,再將起始位置SP之值更新為(SP-LE)。若空旗標已有初始設定,此時會清除空旗標之值。若資料欠位旗標已有初始設定,會將擷取長度LE之值回復至前一擷取長度LE之值,然後再清除資料欠位旗標之值。In FIG. 9, if the starting position SP is greater than the capturing length LE, LE bits are retrieved from the bit stream register scratcher Ra to the target register Rt. The process of extracting a bit when SP>LE is as shown in Fig. 1, and the LE bits (for example, BSR (SP-1, SP-LE)) extracted from the bit stream buffer Ra are stored. The lowest bit portion of the target register Rt (for example, DR(LE-1, 0)). Since the starting position SP is larger than the capturing length LE, some bits are still stored in the data stream buffer Ra after the retrieval, so that the "data under-bit" situation is not caused. At this time, the higher bit portion of the target register Rt (for example, DR (31, LE)) is written to a predetermined value (for example, 0) or remains unchanged according to the initial setting of the data under-counter flag, and then starts. The value of position SP is updated to (SP-LE). If the empty flag has an initial setting, the value of the empty flag will be cleared. If the data under-auversity flag has been initially set, the value of the retrieval length LE is returned to the value of the previous acquisition length LE, and then the value of the data under-counter flag is cleared.
再次參考第9圖,若起始位置SP等於擷取長度LE,此時候會產生空乏情形,因此會設定空旗標,並將目標暫存器Rt之DR(MSB,LE)設為0。接著,從位元資料流暫存器Ra中擷取LE個位元至目標暫存器Rt。SP=LE時擷取位元之過程如第2圖所示,從位元資料流暫存器Ra中擷取出之LE個位元(例如BSR(LE-1,0))會被存入目標暫存器Rt之最低部分(例如DR(LE-1,0))。由於起始位置SP等於擷取長度LE,因此不會造成「資料欠位」的情形,此時目標暫存器Rt之較高位元部分(例如DR(31,LE))會存入一預定值(例如0),再清除資料欠位旗標之值。起始位置SP之值會被更新為位元資料流暫存器Ra之最大有效位元(例如32),以為後續位元擷取來作準備。Referring again to Fig. 9, if the starting position SP is equal to the drawing length LE, a depletion situation will occur at this time, so an empty flag is set and the DR (MSB, LE) of the target register Rt is set to zero. Next, LE bits are retrieved from the bit stream register scratcher Ra to the target register Rt. The process of extracting a bit when SP=LE is as shown in Fig. 2, and the LE bits (for example, BSR(LE-1, 0)) extracted from the bit stream buffer Ra are saved in the target. The lowest part of the register Rt (for example, DR(LE-1, 0)). Since the starting position SP is equal to the drawing length LE, it does not cause a "data under-bit" situation, in which case the higher-order portion of the target register Rt (for example, DR (31, LE)) is stored in a predetermined value. (for example, 0), and then clear the value of the understated flag. The value of the starting position SP is updated to the most significant bit (e.g., 32) of the bit stream buffer Ra to prepare for subsequent bit fetching.
若起始位置SP小於擷取長度LE,此時亦會因為空乏情形而設定空旗標,並將目標暫存器Rt之DR(MSB,LE)設為0。接著,從位元資料流暫存器Ra中擷取SP個位元(例如BSR(SP-1,0))至目標暫存器Rt中從位置LE-1開始之最低位元部分(例如DR(LE-1,LE-SP))。SP<LE時擷取位元之過程如第3圖所示,此時會加入對應於起始位置SP和擷取長度LE差值(SP-LE)之緩衝位元,以增加至擷取長度LE之位元數目。由於起始位置SP小於擷取長度LE,此時會造成「資料欠位」的情形,因此會設定Rb(31)內之資料欠位旗標(例如Rb(31)=1),並將目標暫存器Rt之較高部分設為預定值(例如DR(32,LE)=0)。起始位置SP之值會被更新為位元資料流暫存器Ra之最大有效位元(例如32)以為後續位元擷取來作準備,而擷取長度LE之值會更新為(LE-SP)。在更新擷取長度LE之前,原始擷取長度LE之值會存入一先前擷取長度暫存器prev_LE。If the starting position SP is smaller than the capturing length LE, an empty flag is set at this time due to a lack of space, and the DR (MSB, LE) of the target register Rt is set to zero. Then, SP bits (for example, BSR(SP-1, 0)) are extracted from the bit stream buffer Ra to the lowest bit portion (such as DR) from the position LE-1 in the target register Rt. (LE-1, LE-SP)). The process of extracting a bit when SP<LE is as shown in Fig. 3, at this time, a buffer bit corresponding to the start position SP and the length LE difference (SP-LE) is added to increase the length of the capture. The number of bits in LE. Since the starting position SP is smaller than the drawing length LE, this will cause a "data under-subscription" situation, so the data under-counting flag (for example, Rb(31)=1) in Rb(31) will be set and the target will be The upper portion of the register Rt is set to a predetermined value (for example, DR (32, LE) = 0). The value of the starting position SP is updated to the most significant bit of the bit stream register Ra (for example 32) in preparation for subsequent bit extraction, and the value of the length LE is updated to (LE- SP). The value of the original capture length LE is stored in a previous capture length register prev_LE before the update length LE is updated.
請參考第4圖,第4圖說明了在執行第3圖之位元擷取運作後從位元資料流暫存器Ra中擷取位元之方法,亦即在設定Rb(31)之資料欠位旗標後從位元資料流暫存器Ra中擷取位元之方法。此時,欲擷取之位元數目等於前一次擷取後之剩餘位元數目,亦即等於前一次位元擷取之擷取長度LE減去前一次位元擷取之起始位置SP之值。換而言之,在前一次擷取中進行一完整擷取長度之位元擷取後,未完成的部分即為此次欲擷取之位元。這些欲擷取之位元會被存入目標暫存器Rt之最低位元部分(例如DR(LE-SP-1,0)),也就是在前一次擷取中增加緩衝位元之位置。由於Rb(31)中之資料欠位旗標已被設定,目標暫存器Rt之高位元部分維持不變,因此能保留從前一次擷取中所得到之SP個位元。因此,在起始位置SP小於擷取長度LE時,透過資料欠位旗標和第2圖和第3圖中所述之實施例,本發明可有效率地擷取全部LE個位元。Please refer to FIG. 4, which illustrates the method of extracting bits from the bit stream buffer Ra after performing the bit drawing operation of FIG. 3, that is, setting the data of Rb (31). The method of extracting the bit from the bit stream buffer Ra after the under-flag is used. At this time, the number of bits to be retrieved is equal to the number of remaining bits after the previous capture, that is, equal to the captured length LE of the previous bit minus the starting position of the previous bit. value. In other words, after the bit of a complete capture length is extracted in the previous capture, the unfinished part is the bit to be retrieved. These bits to be fetched are stored in the lowest bit portion of the target register Rt (for example, DR(LE-SP-1, 0)), that is, the position of the buffer bit is added in the previous capture. Since the data under-count flag in Rb (31) has been set, the high-order portion of the target register Rt remains unchanged, so that the SP bits obtained from the previous capture can be retained. Therefore, when the starting position SP is smaller than the drawing length LE, the present invention can efficiently capture all LE bits by the data under-counting flag and the embodiments described in FIGS. 2 and 3.
第5~7圖和第10圖說明了本發明第二實施例中將位元從一來源暫存器(SR)Ra包裝至一位元資料流暫存器Rt之方法。如第5~7圖所示,位元資料流暫存器Rt可包含32個位元,如0~31。來源暫存器Ra之位元可被包裝且儲存至位元資料流暫存器Rt。一結構暫存器Rb可將一預定包裝長度(LE)存入Rb(4,0)、將一預定起始位置(SP)存入Rb(9,5)、將一滿旗標(full flag)存入Rb(13),以及將一資料溢位旗標(overflow flag)存入Rb(31)。當然,預定包裝長度LE、預定起始位置SP、滿旗標和資料溢位旗標可存入結構暫存器Rb內其它位置,甚至存入其它暫存器。第10圖之流程圖說明了本發明第二實施例中將位元從來源暫存器Ra包裝至位元資料流暫存器Rt之方法。5 to 7 and 10 illustrate a method of packaging a bit from a source register (SR) Ra to a bit stream stream register Rt in the second embodiment of the present invention. As shown in Figures 5-7, the bit stream register Rt can contain 32 bits, such as 0-31. The bits of the source register Ra can be packaged and stored in the bit stream register Rt. A structure register Rb can store a predetermined package length (LE) in Rb (4, 0), a predetermined starting position (SP) in Rb (9, 5), and a full flag (full flag) ) is stored in Rb (13), and a data overflow flag is stored in Rb (31). Of course, the predetermined package length LE, the predetermined starting position SP, the full flag and the data overflow flag can be stored in other locations in the structure register Rb, or even stored in other registers. The flowchart of Fig. 10 illustrates a method of packaging a bit from a source register Ra to a bit stream register Rt in the second embodiment of the present invention.
在第10圖中,若起始位置SP大於包裝長度LE,此時會從來源暫存器Ra中包裝LE個位元至位元資料流暫存器Rt。SP>LE時包裝位元之過程如第5圖所示,從來源暫存器Ra中包裝的LE個位元(例如SR(LE-1,0))會被存入位元資料流暫存器Rt中從位置(SP-1)開始之最低位元部分(例如BSR(SP-1,SP-LE))。起始位置SP之值會被更新為(SP-LE),並清除滿旗標之值。若資料溢位旗標已有初始設定(例如Rb(31)=1),此時會清除資料溢位旗標之值,並將包裝長度LE之值回復至前一包裝長度之值prev_LE。In Fig. 10, if the starting position SP is larger than the package length LE, the LE bits are packed from the source register Ra to the bit stream register Rt. The process of packing the bits in SP>LE is as shown in Fig. 5. The LE bits (such as SR(LE-1, 0)) packed from the source register Ra are stored in the bit stream. The lowest bit portion (for example, BSR (SP-1, SP-LE)) from the position (SP-1) in the Rt. The value of the starting position SP is updated to (SP-LE) and the value of the full flag is cleared. If the data overflow flag has been initially set (for example, Rb(31)=1), the value of the data overflow flag will be cleared and the value of the package length LE will be restored to the value of the previous package length prev_LE.
再次參考第10圖,若起始位置SP等於包裝長度LE,此時候會設定滿旗標之值,並從來源暫存器Ra中包裝LE個位元至位元資料流暫存器Rt。SP=LE時包裝位元之過程如第6圖所示,來源暫存器Ra內LE個最低位元(例如SR(LE-1,0))會被包裝且從位置(LE-1)開始存入位元資料流暫存器Rt中(例如BSR(LE-1,0))。由於起始位置SP等於包裝長度LE,所以不會造成「資料溢位」的情形,因此會清除資料溢位旗標之值且不加以設定。起始位置SP之值會被更新為位元資料流暫存器Rt之最大有效位元(例如32),以為後續位元包裝來作準備。Referring again to FIG. 10, if the starting position SP is equal to the package length LE, the full flag value is set at this time, and the LE bits are packed from the source register Ra to the bit stream register Rt. The process of packing the bits in SP=LE is as shown in Fig. 6. The LE lowest bits in the source register Ra (for example, SR(LE-1, 0)) are packaged and start from the position (LE-1). It is stored in the bit stream register Rt (for example, BSR (LE-1, 0)). Since the starting position SP is equal to the package length LE, there is no "data overflow" condition, so the value of the data overflow flag is cleared and is not set. The value of the starting position SP is updated to the most significant bit (e.g., 32) of the bit stream register Rt to prepare for subsequent bit packing.
若起始位置SP小於包裝長度LE,此時會設定滿旗標和資料溢位旗標之值,並從來源暫存器Ra中包裝SP個位元至位元資料流暫存器Rt。SP<LE時包裝位元之過程如第7圖所示,來源暫存器Ra內從LE位置開始往下SP個最低位元(例如SR(LE-1,LE-SP))會被包裝且從位置(SP-1)開始存入位元資料流暫存器Rt中(例如BSR(SP-1,0))。儲存包裝長度LE之暫存器首先存入一先前包裝長度暫存器previous_LE,然後再更新為(LE-SP),而起始位置SP之值會被更新為位元資料流暫存器Rt之最大有效位元(例如32)。先前包裝長度暫存器previous_LE可紀錄更新前之原始包裝長度LE,在資料溢位時進行第二次包裝程序後,可用來回復原始包裝長度LE之值。If the starting position SP is smaller than the package length LE, the values of the full flag and the data overflow flag are set at this time, and SP bits are packed from the source register Ra to the bit stream register Rt. The process of packing the bits in SP<LE is as shown in Fig. 7. The source SP is from the LE position to the next SP lowest bits (for example, SR(LE-1, LE-SP)) and is packaged. It is stored in the bit stream register Rt (for example, BSR(SP-1, 0)) from the position (SP-1). The scratchpad storing the package length LE is first stored in a previous package length register previous_LE, and then updated to (LE-SP), and the value of the start position SP is updated to the bit stream register Rt. The most significant bit (for example, 32). The previous package length register previous_LE can record the original package length LE before the update, and can be used to restore the value of the original package length LE after the second wrapping process in the data overflow.
值得注意的是,本發明可分別使用第1~4圖所示之方法來擷取位元,或是將第1~4圖所示之方法部分/全部整合至位元擷取軟體或硬體。同理,本發明亦可分別使用第5~7圖所示之方法來包裝位元,或是將第5~7圖所示之方法部分/全部整合至位元包裝軟體或硬體。It should be noted that the present invention can use the methods shown in FIGS. 1 to 4 to extract bits, or integrate some/all of the methods shown in FIGS. 1 to 4 into a bit to extract software or hardware. . Similarly, the present invention can also package the bits by using the methods shown in FIGS. 5-7, respectively, or integrate part/all of the methods shown in FIGS. 5-7 into the bit package software or hardware.
請參考第11圖和第12圖,第11圖為本發明實施例中一位元資料流擷取(BSE)裝置之示意圖,可用來實現第9圖所示之位元資料流擷取方法;而第12圖為本發明實施例中一位元資料流包裝(BSP)裝置之示意圖,可用來實現第10圖所示之位元資料流包裝方法。首先說明第11圖所示之BSE裝置,BSE裝置包含複數個正反器(flip-flop,FF,也可稱暫存器)11、13、15、17、19、21和23,一用來產生選擇控制訊號之控制邏輯41,複數個能依據選擇控制訊號來選擇輸入訊號之多工器(multiplexer)31、33、35、37和39,一運算邏輯單元(arithmetic logic unit,ALU)/比較器43,以及一遮罩產生器(mask generator)45。複數個正反器11~23包含一空旗標(e_f)11、一資料欠位旗標(u_f)13、用來儲存起始位置之一起始位置暫存器(SP)15、用來儲存先前擷取長度之一先前擷取長度暫存器(Prev_LE)17、一用來儲存擷取長度之擷取長度暫存器(LE)19、用來儲存擷取資料之一位元資料流暫存器(BSR)21,以及一目標暫存器(DR)23。在複數個多工器31~39中,空旗標多工器31耦接至空旗標11、資料欠位旗標多工器33耦接至資料欠位旗標13、起始位置多工器35耦接至起始位置暫存器15和ALU/比較器43、先前擷取長度多工器37耦接至先前擷取長度暫存器17和擷取長度暫存器19,而擷取長度旗標多工器39耦接至擷取長度正反器19和ALU/比較器43。BSE裝置另包含一左向/右向移位器49,可依據ALU/比較器43所產生之差異結果∣A-B∣之值來對從位元資料流暫存器21中擷取出的資料進行移位處理。在第11圖中,訊號值51、53和55僅用來說明本實施例,並不限定本發明的範疇。Please refer to FIG. 11 and FIG. 12 . FIG. 11 is a schematic diagram of a bit stream data stream capture (BSE) device according to an embodiment of the present invention, which can be used to implement the bit stream data capture method shown in FIG. 9; FIG. 12 is a schematic diagram of a bit stream data stream packaging (BSP) device according to an embodiment of the present invention, which can be used to implement the bit stream packaging method shown in FIG. First, the BSE device shown in FIG. 11 will be described. The BSE device includes a plurality of flip-flops (FFs, also referred to as registers) 11, 13, 15, 17, 19, 21, and 23, one for A control logic 41 for selecting a control signal is generated, and a plurality of multiplexers 31, 33, 35, 37, and 39 capable of selecting an input signal according to the selection control signal, an arithmetic logic unit (ALU)/comparison The device 43, and a mask generator 45. The plurality of flip-flops 11 to 23 include an empty flag (e_f) 11, a data under-count flag (u_f) 13, and a start position register (SP) 15 for storing the start position for storing the previous One of the lengths of the previous capture length register (Prev_LE) 17, a storage length register (LE) 19 for storing the length of the capture, one bit stream for storing the retrieved data stream temporary storage (BSR) 21, and a target register (DR) 23. In the plurality of multiplexers 31-39, the empty flag multiplexer 31 is coupled to the empty flag 11, the data under-flag multiplexer 33 is coupled to the data under-counter flag 13, and the starting position is multiplexed. The device 35 is coupled to the start location register 15 and the ALU/comparator 43, the previous capture length multiplexer 37 is coupled to the previous capture length register 17 and the capture length register 19, and is captured. The length flag multiplexer 39 is coupled to the pull length flip flop 19 and the ALU/comparator 43. The BSE apparatus further includes a left/right shifter 49 for shifting the data extracted from the bit stream register 21 in accordance with the difference result ∣AB∣ generated by the ALU/comparator 43. Bit processing. In Fig. 11, the signal values 51, 53 and 55 are only used to illustrate the embodiment, and do not limit the scope of the invention.
在運作時,ALU/比較器43接收起始位置正反器15和擷取長度正反器19,並將比較結果(例如”SP>LE”、”SP=LE”或“SP<LE”)傳送至控制邏輯41。依據起始位置和擷取長度,運算邏輯單元43亦可產生差異結果|A-B|。依據比較結果,控制邏輯41可輸出控制訊號至多工器31和33以分別設定或清除空旗標和資料欠位旗標之值,同時亦可輸出控制訊號至多工器35、37和39以分別更新起始位置正反器15、先前擷取長度正反器17和擷取長度正反器19之值。在依據控制邏輯41傳送之控制訊號來決定移位方向,以及依據ALU/比較器43所產生之|A-B|來決定移位量後,左向/右向移位器49可對從位元資料流暫存器21中擷取出的資料進行移位處理,再將移位後之資料傳送至目標暫存器23。遮罩產生器45可產生一遮罩信號,用來將目標暫存器23之高位元部份設為一預定值,例如將DR(32,LE)設為0。遮罩產生器45、左向/右向移位器49和目標暫存器23可耦接至一第一邏輯單元63,如此能對遮罩信號和移位後之資料執行邏輯及(logic AND)運算。In operation, the ALU/comparator 43 receives the start position flip-flop 15 and the capture length flip-flop 19 and compares the results (eg, "SP>LE", "SP=LE" or "SP<LE") Transfer to control logic 41. The arithmetic logic unit 43 can also generate a difference result |A-B| depending on the start position and the draw length. According to the comparison result, the control logic 41 can output control signals to the multiplexers 31 and 33 to respectively set or clear the values of the empty flag and the data under-flag flag, and can also output the control signals to the multiplexers 35, 37 and 39 respectively. The values of the home position flip-flop 15, the previous length flip-flop 17 and the length-of-length flip-flop 19 are updated. After the shift direction is determined according to the control signal transmitted by the control logic 41, and the shift amount is determined according to |AB| generated by the ALU/comparator 43, the left/right shifter 49 can access the slave data. The data extracted from the stream register 21 is subjected to shift processing, and the shifted data is transferred to the target register 23. The mask generator 45 can generate a mask signal for setting the high-order portion of the target register 23 to a predetermined value, for example, setting DR (32, LE) to zero. The mask generator 45, the left/right shifter 49 and the target register 23 can be coupled to a first logic unit 63, so that the logic signal can be performed on the mask signal and the shifted data (logic AND ) Operation.
綜上所述,第11圖所示之BSE裝置之控制邏輯41可實現:In summary, the control logic 41 of the BSE device shown in FIG. 11 can realize:
(1)更新擷取長度;(1) update the length of the capture;
(2)更新起始位置;(2) update the starting position;
(3)控制左向/右向移位器49之移位方向;(3) controlling the shift direction of the left/right shifter 49;
(4)控制起始位置多工器以從最大有效位元和差異結果中選取起始位置;(4) controlling the starting position multiplexer to select the starting position from the most significant bit and the difference result;
(5)控制資料欠位旗標多工器以設定或清除資料欠位旗標之值;(5) Control the data under-auversity flag multiplexer to set or clear the value of the data under-auversity flag;
(6)控制先前擷取長度多工器以選擇維持先前擷取長度或更新先前擷取長度之值;(6) controlling the previous capture length multiplexer to choose to maintain the previous capture length or update the value of the previous capture length;
(7)控制擷取長度多工器以選擇維持擷取長度,或將擷取長度之值更新為先前擷取長度暫存器之值或差異結果;以及(7) controlling the length multiplexer to select to maintain the length of the capture, or updating the value of the length of the capture to the value of the previously retrieved length register or the result of the difference;
(8)控制空旗標多工器以依據比較結果設定或清除空旗標之值。(8) Control the empty flag multiplexer to set or clear the value of the empty flag according to the comparison result.
第12圖所示之BSE裝置,BSP裝置包含複數個正反器(也可稱為暫存器)11、13、15、17、19、21和23,一用來產生選擇控制訊號之控制邏輯41,複數個能依據選擇控制訊號來選擇輸入訊號之多工器31、33、35、37和39,一ALU/比較器43、一遮罩產生器45、一第一左向/右向移位器49,以及一第二左向/右向移位器57。在複數個正反器11~23中,滿旗標(f_f)11可儲存滿旗標之值、資料溢位旗標(of)13可儲存資料溢位旗標之值、起始位置暫存器(SP)可儲存起始位置之值、先前包裝長度暫存器(Prev_LE)17可儲存先前包裝長度之值、包裝長度暫存器(LE)19可來儲存包裝長度之值、來源暫存器(SR)21可儲存包裝資料,以及一目標位元資料流暫存器(BSR)23。在複數個多工器31~39中,滿旗標多工器31耦接至控制邏輯41和滿旗標11,資料溢位旗標多工器33耦接至控制邏輯41和資料溢位旗標13、起始位置多工器35耦接至起始位置暫存器15、ALU/比較器43和控制邏輯41,先前包裝長度多工器37耦接至控制邏輯41、先前包裝長度正反器17和包裝長度正反器19,而包裝長度多工器39耦接至ALU/比較器43、擷取長度正反器19、先前包裝長度正反器17和控制邏輯41。在第12圖中,訊號值51、53和55僅用來說明本實施例,並不限定本發明的範疇。In the BSE apparatus shown in Fig. 12, the BSP apparatus includes a plurality of flip-flops (also referred to as registers) 11, 13, 15, 17, 19, 21, and 23, and a control logic for generating a selection control signal. 41. A plurality of multiplexers 31, 33, 35, 37, and 39 capable of selecting an input signal according to the selection control signal, an ALU/comparator 43, a mask generator 45, and a first left/right shift The bit 49, and a second left/right shifter 57. In the plurality of flip-flops 11 to 23, the full flag (f_f) 11 can store the value of the full flag, the data overflow flag (of) 13 can store the value of the data overflow flag, and the initial position is temporarily stored. The SP (SP) can store the value of the starting position, the previous package length register (Prev_LE) 17 can store the value of the previous package length, the package length register (LE) 19 can store the value of the package length, the source is temporarily stored. The (SR) 21 can store package information and a target bit stream register (BSR) 23. In the plurality of multiplexers 31-39, the full flag multiplexer 31 is coupled to the control logic 41 and the full flag 11, and the data overflow flag multiplexer 33 is coupled to the control logic 41 and the data overflow flag. The starting position multiplexer 35 is coupled to the home position register 15, the ALU/comparator 43 and the control logic 41. The previous package length multiplexer 37 is coupled to the control logic 41, and the previous package length is positive and negative. The package 17 and the package length flip-flop 19 are coupled to the ALU/comparator 43, the length-length flip-flop 19, the previous package length flip-flop 17 and the control logic 41. In Fig. 12, the signal values 51, 53 and 55 are only used to illustrate the embodiment, and do not limit the scope of the invention.
在運作時,ALU/比較器43接收起始位置正反器15和包裝長度正反器19,並將比較結果(例如”SP>LE”、”SP=LE”或“SP<LE”)傳送至控制邏輯41。依據起始位置和擷取長度,運算邏輯單元43亦可產生差異結果|A-B|。依據比較結果,控制邏輯41可輸出控制訊號至多工器31和33以分別設定或清除滿旗標和資料溢位旗標之值,同時亦可輸出控制訊號至多工器35、37和39以分別更新起始位置正反器15、先前包裝長度正反器17和包裝長度正反器19之值。在依據控制邏輯41傳送之控制訊號來決定移位方向,以及依據ALU/比較器43所產生之|A-B|來決定移位量後,左向/右向移位器49和57可對從來源暫存器21中擷取出的資料和遮罩產生器45所產生之遮罩信號53進行移位處理,再將移位後之資料傳送至目標位元資料流暫存器23,以及將移位後之遮罩信號53傳送至一邏輯及閘單元61。遮罩產生器45可產生遮罩信號,在位元包裝前後,遮罩信號可保持目標位元資料流暫存器23之高位元部份之原始值。In operation, the ALU/comparator 43 receives the home position flip-flop 15 and the package length flip-flop 19 and transmits the comparison result (eg, "SP>LE", "SP=LE" or "SP<LE") To control logic 41. The arithmetic logic unit 43 can also generate a difference result |A-B| depending on the start position and the draw length. According to the comparison result, the control logic 41 can output control signals to the multiplexers 31 and 33 to respectively set or clear the values of the full flag and the data overflow flag, and can also output the control signals to the multiplexers 35, 37 and 39 respectively. The values of the home position flip-flop 15, the previous package length flip-flop 17, and the package length flip-flop 19 are updated. The left/right shifters 49 and 57 are available from the source after determining the shift direction based on the control signal transmitted by the control logic 41 and determining the shift amount based on |AB| generated by the ALU/comparator 43. The data extracted from the register 21 and the mask signal 53 generated by the mask generator 45 are shifted, and the shifted data is transferred to the target bit stream register 23, and the shift is shifted. The subsequent mask signal 53 is transmitted to a logic and gate unit 61. The mask generator 45 can generate a mask signal that maintains the original value of the high order portion of the target bit stream buffer 23 before and after the bit packing.
綜上所述,第12圖所示之BSP裝置之控制邏輯41可實現:In summary, the control logic 41 of the BSP device shown in Fig. 12 can realize:
(1)更新包裝長度;(1) update the package length;
(2)更新起始位置;(2) update the starting position;
(3)控制左向/右向移位器49和57之移位方向;(3) controlling the shift direction of the left/right shifters 49 and 57;
(4)控制起始位置多工器以從最大有效位元和差異結果中選取起始位置;(4) controlling the starting position multiplexer to select the starting position from the most significant bit and the difference result;
(5)控制資料溢位旗標多工器以設定或清除資料溢位旗標之值;(5) Control the data overflow flag multiplexer to set or clear the value of the data overflow flag;
(6)控制先前包裝長度多工器以選擇維持先前包裝長度或更新先前包裝長度之值;(6) controlling the previous package length multiplexer to choose to maintain the previous package length or update the value of the previous package length;
(7)控制包裝長度多工器以選擇維持包裝長度,或將包裝長度之值更新為先前包裝長度暫存器之值或差異結果;以及(7) controlling the package length multiplexer to choose to maintain the package length, or to update the value of the package length to the value of the previous package length register or the difference result;
(8)控制滿旗標多工器以依據比較結果設定或清除滿旗標之值。(8) Control the full flag multiplexer to set or clear the value of the full flag according to the comparison result.
在前述擷取和包裝位元方法之實施例以及BSE/BSP裝置中,當連續擷取或包裝位元時,本發明使用空旗標、滿旗標、資料欠位旗標和資料溢位旗標來處理「資料欠位」和「資料溢位」等邊界條件。在「資料欠位」進行擷取時,本發明會自動地調整位元資料流來源暫存器之起始位置和組態暫存器內之擷取長度,進而連續執行兩次擷取運作,而在第二次擷取時並不改變目標暫存器的高位元,因此能更有效率地處理在「資料欠位」時之擷取運作。在「資料溢位」進行包裝時,本發明會自動地調整位元資料流目標暫存器之起始位置和組態暫存器內之包裝長度,進而連續執行兩次包裝運作,因此能更有效率地處理在「資料溢位」時之包裝運作。綜上所述,本發明使用起始位置自動更新,擷取/包裝長度自動更新與回復,來增加工作的平行度,因此會提高系統效率。In the foregoing embodiments of the method of capturing and packaging bits and the BSE/BSP device, the present invention uses an empty flag, a full flag, an under-status flag, and a data overflow flag when continuously capturing or packaging a bit. It is used to deal with boundary conditions such as "data under-subscription" and "data overflow". When the "data under-position" is captured, the present invention automatically adjusts the starting position of the bit stream source register and the read length in the configuration register, thereby continuously performing the capture operation twice. In the second acquisition, the high-order bits of the target register are not changed, so that the operation of the "data under-subscription" can be handled more efficiently. When the "data overflow" is packaged, the present invention automatically adjusts the starting position of the bit stream stream target register and the package length in the configuration register, thereby continuously performing the packaging operation twice, thereby enabling Efficiently handle packaging operations during "data overflow". In summary, the present invention automatically updates and retrieves the length of the capture/package using the automatic starting position, thereby increasing the parallelism of the work, thereby improving system efficiency.
以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。The above are only the preferred embodiments of the present invention, and all changes and modifications made to the scope of the present invention should be within the scope of the present invention.
11~23...正反器(暫存器)11~23. . . Positive and negative (storage)
31~39...多工器31~39. . . Multiplexer
41...控制邏輯41. . . Control logic
43...ALU/比較器43. . . ALU/comparator
45...遮罩產生器45. . . Mask generator
49、57...移位器49, 57. . . Shifter
1300~1800...範例指令程序1300~1800. . . Sample instruction program
Ra、Rb、Rt...暫存器Ra, Rb, Rt. . . Register
第1~4圖為本發明第一實施例中從一位元資料流暫存器中擷取位元方法之示意圖。1 to 4 are schematic views showing a method of extracting a bit from a one-bit data stream register in the first embodiment of the present invention.
第5~7圖為本發明第二實施例中將位元從一來源暫存器包裝至一位元資料流暫存器方法之示意圖。5 to 7 are schematic diagrams showing a method of packaging a bit from a source register to a bit stream buffer in the second embodiment of the present invention.
第8圖為先前技術中一擷取位元方法之示意圖。Figure 8 is a schematic diagram of a method of picking up bits in the prior art.
第9圖為本發明第一實施例中從一位元資料流暫存器中擷取位元方法之流程圖。FIG. 9 is a flow chart of a method for extracting a bit from a one-bit data stream register in the first embodiment of the present invention.
第10圖為本發明第二實施例中將位元從一來源暫存器包裝至一位元資料流暫存器方法之流程圖。FIG. 10 is a flow chart of a method for packaging a bit from a source register to a bit stream register in the second embodiment of the present invention.
第11圖為本發明實施例中一位元資料流擷取裝置之示意圖。FIG. 11 is a schematic diagram of a one-bit data stream capture device according to an embodiment of the present invention.
第12圖為本發明實施例中一位元資料流包裝裝置之示意圖。FIG. 12 is a schematic diagram of a one-bit data stream packaging apparatus according to an embodiment of the present invention.
第13~15圖為先前技術中一擷取位元方法之示意圖。Figures 13 to 15 are schematic views of a method of picking up bits in the prior art.
第16~18圖為先前技術中一包裝位元方法之示意圖。Figures 16-18 are schematic diagrams of a method of packaging a bit in the prior art.
11~23...正反器(暫存器)11~23. . . Positive and negative (storage)
31~39...多工器31~39. . . Multiplexer
41...控制邏輯41. . . Control logic
43...ALU/比較器43. . . ALU/comparator
45...遮罩產生器45. . . Mask generator
49...移位器49. . . Shifter
Claims (31)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW97148208A TWI394043B (en) | 2008-12-11 | 2008-12-11 | Method of handling successive bitstream extraction and packing and related device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW97148208A TWI394043B (en) | 2008-12-11 | 2008-12-11 | Method of handling successive bitstream extraction and packing and related device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TW201022934A TW201022934A (en) | 2010-06-16 |
| TWI394043B true TWI394043B (en) | 2013-04-21 |
Family
ID=44833178
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW97148208A TWI394043B (en) | 2008-12-11 | 2008-12-11 | Method of handling successive bitstream extraction and packing and related device |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI394043B (en) |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030120904A1 (en) * | 1999-11-18 | 2003-06-26 | Sun Microsystems, Inc. | Decompression bit processing with a general purpose alignment tool |
| US6844834B2 (en) * | 2002-05-22 | 2005-01-18 | Sony Corporation | Processor, encoder, decoder, and electronic apparatus |
| TWI267304B (en) * | 2005-01-30 | 2006-11-21 | Taifatech Inc | System and method for extracting and routing audio-video programs from transport stream packets |
| TWI275273B (en) * | 2004-03-03 | 2007-03-01 | Mediatek Inc | Method and apparatus for extracting payload from a packetized elementary stream packet |
| US7315937B2 (en) * | 2004-10-01 | 2008-01-01 | Mips Technologies, Inc. | Microprocessor instructions for efficient bit stream extractions |
| TW200805954A (en) * | 2006-06-06 | 2008-01-16 | Litepoint Corp | Method for capturing multiple data packets in a data signal for analysis |
| TW200807956A (en) * | 2006-06-06 | 2008-02-01 | Litepoint Corp | Apparatus for capturing multiple data packets in a data signal for analysis |
-
2008
- 2008-12-11 TW TW97148208A patent/TWI394043B/en active
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030120904A1 (en) * | 1999-11-18 | 2003-06-26 | Sun Microsystems, Inc. | Decompression bit processing with a general purpose alignment tool |
| US6844834B2 (en) * | 2002-05-22 | 2005-01-18 | Sony Corporation | Processor, encoder, decoder, and electronic apparatus |
| TWI275273B (en) * | 2004-03-03 | 2007-03-01 | Mediatek Inc | Method and apparatus for extracting payload from a packetized elementary stream packet |
| US7315937B2 (en) * | 2004-10-01 | 2008-01-01 | Mips Technologies, Inc. | Microprocessor instructions for efficient bit stream extractions |
| TWI267304B (en) * | 2005-01-30 | 2006-11-21 | Taifatech Inc | System and method for extracting and routing audio-video programs from transport stream packets |
| TW200805954A (en) * | 2006-06-06 | 2008-01-16 | Litepoint Corp | Method for capturing multiple data packets in a data signal for analysis |
| TW200807956A (en) * | 2006-06-06 | 2008-02-01 | Litepoint Corp | Apparatus for capturing multiple data packets in a data signal for analysis |
Also Published As
| Publication number | Publication date |
|---|---|
| TW201022934A (en) | 2010-06-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109308192B (en) | Systems and methods for performing memory compression | |
| US8463724B2 (en) | Computer archive traversal | |
| US20150193353A1 (en) | Compressed Level Two Block Buffer Metadata Cache | |
| TWI408600B (en) | Conpute unit with an internal bit fifo circuit | |
| CN110175900B (en) | Buffer account supplementing method and device | |
| KR101535703B1 (en) | Apparatus and method for converting Value Object | |
| US9633032B2 (en) | Object synthesis | |
| CN105912675A (en) | Batch delete/query method and apparatus for merging small files | |
| US8370309B1 (en) | Revision-tolerant data de-duplication | |
| CN101739239B (en) | Method and related device for continuously extracting and packing bit data stream | |
| US8489832B1 (en) | System and method for duplicating electronically stored data | |
| TWI394043B (en) | Method of handling successive bitstream extraction and packing and related device | |
| CN104866285B (en) | Programmable controller | |
| CN109992292A (en) | An Adaptive Bidirectional Differential Algorithm Based on Block Writeback | |
| KR102822275B1 (en) | A compression system that uses longest match processing to produce compressed data. | |
| JP5351972B2 (en) | Multimedia data recording | |
| US20190250830A1 (en) | Systems and methods for low latency hardware memory management | |
| CN101911198A (en) | Method and apparatus for managing and editing files in a file system | |
| TWI474718B (en) | File management method and related apparatus | |
| CN101156134A (en) | processor | |
| JP7638968B2 (en) | Command processor with multiple string copy engines for decompression systems | |
| CN103530417B (en) | file unpacking method and device | |
| TWI344109B (en) | High efficient pipelined decompression method with no-wait time | |
| CN113434545B (en) | Data caching device and data providing method | |
| WO2011099104A1 (en) | File name management method and file name management device |