JP2010140192A - Barrel shifter device and barrel shifting method - Google Patents

Barrel shifter device and barrel shifting method Download PDF

Info

Publication number
JP2010140192A
JP2010140192A JP2008314895A JP2008314895A JP2010140192A JP 2010140192 A JP2010140192 A JP 2010140192A JP 2008314895 A JP2008314895 A JP 2008314895A JP 2008314895 A JP2008314895 A JP 2008314895A JP 2010140192 A JP2010140192 A JP 2010140192A
Authority
JP
Japan
Prior art keywords
bit
shift
zero mask
selector
bits
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
JP2008314895A
Other languages
Japanese (ja)
Other versions
JP5182053B2 (en
Inventor
Shohei Nomoto
祥平 野本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2008314895A priority Critical patent/JP5182053B2/en
Publication of JP2010140192A publication Critical patent/JP2010140192A/en
Application granted granted Critical
Publication of JP5182053B2 publication Critical patent/JP5182053B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a barrel shifter device and a barrel shifting method for achieving a P bit barrel shifter whose bit width is wider by adding a few pieces of hardware to a plurality of N bit barrel shifters. <P>SOLUTION: This barrel shifter device includes: P pieces of Mto1 selectors 2; and a shift quantity control part 3 for generating the select signal of each Mto1 selector 2 based on a shift direction and shift width, and the low order (K mod N) bit-th shift results of M pieces of N bit barrel shifters 1 are connected to the low order K-th Mto1 selector 2, and when the select signal of the low order K-th Mto1 selector 2 is in an L level, the low order K-th Mto1 selector 2 selects the low order (K mod N)th shift result of the low order R(when K/N≥L, R=K/N-L, when K/N<L, R=K/N-L+M)th N bit barrel shifter 1, and obtains the selection result of the low order K-th Mto1 selector 2 as the low order K bit-th shift result of a P bit barrel shifter 10. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、複数のバレルシフタを組み合わせたバレルシフタに関し、特に、複数のバレルシフタの組み合わせ、ビット幅よりも広いバレルシフタを低コストに実現するバレルシフタ装置及びバレルシフト方法に関する。   The present invention relates to a barrel shifter in which a plurality of barrel shifters are combined, and more particularly, to a barrel shifter device and a barrel shift method for realizing a combination of a plurality of barrel shifters and a barrel shifter wider than a bit width at a low cost.

様々な汎用プロセッサやDSP(Digital Signal Processor)には、数値のシフトやローテートを実現するためのビットシフタが実装されてきた。   Various general-purpose processors and DSPs (Digital Signal Processors) have been mounted with bit shifters for realizing numerical shift and rotation.

ビットシフタは、数値の乗算や除算の高速化、数値からの所望ビットパターンの切り出しやビットパターンの合成、シリアルパラレル変換などに利用されてきた。   Bit shifters have been used for speeding up multiplication and division of numerical values, extraction of desired bit patterns from numerical values, synthesis of bit patterns, serial parallel conversion, and the like.

これまでは、ハードウェア資源の節約などから、1ビット単位のシフトやローテートを実現する1ビットシフタがプロセッサに実装されてきた。   Until now, in order to save hardware resources, a 1-bit shifter that implements shift and rotation in 1-bit units has been implemented in a processor.

しかし近年では、半導体スケーリング則の進展に伴い、ハードウェア資源の制約が緩やかになり、一度に任意ビットのシフトやローテートを実現するバレルシフタがプロセッサに実装されている。これにより、数値の乗算や除算、数値からの所望ビットパターンの切り出しやビットパターンの合成、シリアルパラレル変換などの高速化が実現され、浮動小数点演算における小数点位置合わせや、浮動小数点演算結果の正規化処理なども高速に処理できるようになった。   However, in recent years, with the progress of semiconductor scaling rules, hardware resource restrictions have become milder, and a barrel shifter that realizes shifting and rotation of arbitrary bits at a time is mounted on a processor. As a result, high-speed operations such as multiplication and division of numerical values, extraction of desired bit patterns from numerical values, synthesis of bit patterns, serial parallel conversion, etc. are realized, and decimal point alignment in floating point arithmetic and normalization of floating point arithmetic results Processing can be performed at high speed.

図27に、非特許文献1に開示されているような標準的なバレルシフタの構成例を示す。バレルシフタ100は、4bitの入力データ(In[3:0])に対して、左・右ローテート、左・右論理シフトを行う。図27に示すように、4ビットバレルシフタ100は、4個の2to1セレクタが2段カスケードされており、各段の4個の2to1セレクタは、それぞれ前段の同じビット位置の2to1セレクタの出力(又は入力データ)か、1〜2ビット離れた位置の2to1セレクタの出力(又は入力データ)を選択する。   FIG. 27 shows a configuration example of a standard barrel shifter as disclosed in Non-Patent Document 1. The barrel shifter 100 performs left / right rotation and left / right logical shift on 4-bit input data (In [3: 0]). As shown in FIG. 27, the 4-bit barrel shifter 100 has four 2to1 selectors cascaded in two stages, and each of the four 2to1 selectors at each stage outputs (or inputs) the 2to1 selector at the same bit position in the previous stage. Data) or the output (or input data) of the 2to1 selector at a position 1 to 2 bits away.

0段目の各2to1セレクタ101は、入力データ(In[3:0])の同じビット位置のデータか、1ビット離れたビット位置の入力データを選択する。一方、1段目の各2to1セレクタ102は、前段の2to1セレクタ101の同じビット位置のデータか、前段の2to1セレクタ101の2ビット離れたビット位置のデータを選択する。   Each 2to1 selector 101 in the 0th stage selects data at the same bit position of input data (In [3: 0]) or input data at a bit position one bit apart. On the other hand, each 2to1 selector 102 in the first stage selects data at the same bit position of the previous 2to1 selector 101 or data at a bit position two bits away from the previous 2to1 selector 101.

一般的に、Nビットのバレルシフタは、N個の2to1セレクタを(log2N)段カスケードし、各段のN個の2to1セレクタは、前段の同じビット位置の2to1セレクタの出力(又は入力データ)か、1〜2^(log2N-1)ビット離れた位置の2to1セレクタの出力(又は入力データ)を選択する。   In general, an N-bit barrel shifter cascades N 2to1 selectors in (log2N) stages, and the N 2to1 selectors in each stage are outputs (or input data) of the 2to1 selector at the same bit position in the previous stage, Select the output (or input data) of the 2to1 selector at a position 1 to 2 ^ (log2N-1) bits away.

また、シフト量制御部103により、4ビットバレルシフタのシフト方向(lr0、左:1、右:0)とシフト幅(sw0[1:0])とから、各段の2to1セレクタの制御信号(s0[1:0])を生成する。なお、図27においては、シフト量制御部103と2to1セレクタ101及び102との接続は省略している。   Further, the shift amount control unit 103 determines the control signal (s0) of the 2-to-1 selector at each stage from the shift direction (lr0, left: 1, right: 0) and the shift width (sw0 [1: 0]) of the 4-bit barrel shifter. [1: 0]). In FIG. 27, the connection between the shift amount control unit 103 and the 2to1 selectors 101 and 102 is omitted.

Nビットバレルシフタを構成する(log2N)段の各N個の2to1セレクタは、一般的には、左又は右の一方のみのローテート(シフト)をサポートする。このため、入力データ(In)をシフトさせたい方向(Ir0、左:1、右:0)と、2to1セレクタのシフト方向とが一致しない場合には、図28に示すように、シフト量制御部103において(N-sw0)を計算し、その結果を2to1セレクタの制御信号(s0)とすることにより、左右方向のローテート(シフト)を実現している。なお、図28においてsubへの入力の一方である“3'b100”の“3'b”の部分は3ビットの入力であることを示しており、“100”の部分は3ビットの値が100であることを示している。同様に、subへの入力の他方に含まれる“1'b0”の“1'b”の部分は1ビットの入力であることを示しており、“0”の部分は1ビットの値が0であることを示している。これは本明細書の他の図に関しても同様である。   Each of the N 2to1 selectors in the (log2N) stages constituting the N-bit barrel shifter generally supports only one of left or right rotation (shift). Therefore, if the direction in which the input data (In) is to be shifted (Ir0, left: 1, right: 0) and the shift direction of the 2to1 selector do not match, as shown in FIG. In (103), (N-sw0) is calculated, and the result is used as the control signal (s0) of the 2to1 selector, thereby realizing horizontal rotation (shift). In FIG. 28, the “3′b100” portion of “3′b100” which is one of the inputs to the sub indicates that it is a 3-bit input, and the “100” portion has a 3-bit value. 100. Similarly, the “1′b” portion of “1′b0” included in the other of the inputs to the sub indicates that it is a 1-bit input, and the “0” portion has a 1-bit value of 0. It is shown that. The same applies to other figures in this specification.

次に、ゼロマスク制御部104により、4ビットバレルシフタのシフト方向(lr0)とローテートフラグ(rot0)とシフト幅(sw0)とから、左論理シフト時のシフト結果の下位ビットに0を、右論理シフト時のシフト結果の上位ビットに0を挿入するための4ビットゼロマスク(ZM0)を生成する。   Next, the zero mask controller 104 shifts the lower bit of the shift result at the time of the left logical shift from 0 to the right logical shift from the shift direction (lr0), rotate flag (rot0) and shift width (sw0) of the 4-bit barrel shifter. A 4-bit zero mask (ZM0) for inserting 0 into the upper bits of the time shift result is generated.

図29に、ゼロマスク制御部104の詳細を示す。まず図29に示したように、ゼロマスク制御部104は、ゼロマスク生成部105により、4ビットバレルシフタのシフト方向(lr0)とシフト幅(sw0)とから、左論理シフト時のシフト結果の下位ビットに0を挿入するための4ビットの左ゼロマスク(LZM0)、右論理シフト時のシフト結果の上位ビットに0を挿入するための4ビットのゼロマスク(RZM0)を生成する。   FIG. 29 shows details of the zero mask control unit 104. First, as shown in FIG. 29, the zero mask control unit 104 uses the zero mask generation unit 105 to convert the shift direction (lr0) and shift width (sw0) of the 4-bit barrel shifter into lower bits of the shift result at the left logical shift. A 4-bit left zero mask (LZM0) for inserting 0 and a 4-bit zero mask (RZM0) for inserting 0 into the upper bits of the shift result at the right logical shift are generated.

そして、シフト方向(lr0、左:1、右:0)に基づき、左ゼロマスク(LZM0)又は右ゼロマスク(RZM0)をセレクタ106によって選択し、ローテートフラグ(rot0、ローテート:1、論理シフト:0)に基づいて、セレクタ106の選択結果か全ビットが1であるローテート用のワンマスク(ONE)かをセレクタ107によって選択する。   Then, based on the shift direction (lr0, left: 1, right: 0), the left zero mask (LZM0) or the right zero mask (RZM0) is selected by the selector 106, and the rotate flag (rot0, rotate: 1, logical shift: 0) Based on the above, the selector 107 selects the selection result of the selector 106 or the one mask for rotation (ONE) in which all bits are 1.

最後に、ゼロマスク制御部104が生成したゼロマスク(ZM0)と、1段目の2to1セレクタ102の出力のシフト結果との論理積をAND回路108によって計算し、シフト結果(Out)として出力する。   Finally, the AND circuit 108 calculates the logical product of the zero mask (ZM0) generated by the zero mask control unit 104 and the shift result of the output of the first stage 2to1 selector 102, and outputs the result as the shift result (Out).

以上により、4ビットバレルシフタ100は、左右方向のローテートや左右方向の論理シフトを実現する。   As described above, the 4-bit barrel shifter 100 realizes left / right rotation and left / right logical shift.

一方、近年では、複数(M、M:2以上の整数)個のN(2のべき乗)ビットバレルシフタを組み合わせ、ビット幅のより広いバレルシフタとして利用する実装が増えている。例えば、非特許文献2には、4×16bit、2×32bit、1×64bit単位や、4×32bit、2×64bit単位でのシフトの機能が開示されている。また、特許文献1には、Nビットのバレルシフタ単位回路をM段有するバレルシフタが開示されている。   On the other hand, in recent years, there is an increasing number of mountings in which a plurality of (M, M: integers of 2 or more) N (powers of 2) bit barrel shifters are combined and used as a barrel shifter having a wider bit width. For example, Non-Patent Document 2 discloses a shift function in units of 4 × 16 bits, 2 × 32 bits, and 1 × 64 bits, and 4 × 32 bits and 2 × 64 bits. Patent Document 1 discloses a barrel shifter having M stages of N-bit barrel shifter unit circuits.

非特許文献2や特許文献1に開示される発明の一例として、4ビットバレルシフタを二つ組み合わせた、8ビットバレルシフタの一般的な構成例を図30に示す。8ビットバレルシフタ200は、4bitの入力データ(In[3:0])に対して、左・右ローテート、左・右論理シフトを行う二つの4ビットバレルシフタ201、202を組み合わせたものである。   As an example of the invention disclosed in Non-Patent Document 2 and Patent Document 1, FIG. 30 shows a general configuration example of an 8-bit barrel shifter in which two 4-bit barrel shifters are combined. The 8-bit barrel shifter 200 is a combination of two 4-bit barrel shifters 201 and 202 that perform left / right rotation and left / right logical shift on 4-bit input data (In [3: 0]).

図30に示すように、8ビットバレルシフタ200は、二つの4ビットバレルシフタ201、202、及びこれらに対応するシフト量制御部205a、205b及びゼロマスク制御部206a、206bに加えて、6個の2to1セレクタ203と、8個の2to1セレクタ204と、8ビットバレルシフタのシフト方向(lr3)とシフト幅(sw3[2:0])とから、8個のセレクタ204の制御信号(s3)を生成するシフト量制御部205cと、8ビットバレルシフトのシフト方向(lr3)とローテートフラグ(rot3)とシフト幅(sw3)とから、左論理シフト時のシフト結果の下位ビットに0を、右論理シフトのシフト結果の上位ビットに0を挿入するための8ビットゼロマスク(ZM3)を生成するゼロマスク制御部206cと、ゼロマスク制御部206が生成したゼロマスク(ZM3)と8個の2to1セレクタ204の出力との論理積を計算する8個のAND回路207とを有する。   As shown in FIG. 30, the 8-bit barrel shifter 200 includes six 2-to-1 selectors in addition to the two 4-bit barrel shifters 201 and 202 and the shift amount control units 205a and 205b and the zero mask control units 206a and 206b corresponding thereto. 203, eight 2to1 selectors 204, and the shift amount for generating the control signals (s3) of the eight selectors 204 from the shift direction (lr3) and the shift width (sw3 [2: 0]) of the 8-bit barrel shifter Based on the control unit 205c, the shift direction (lr3) of the 8-bit barrel shift, the rotate flag (rot3), and the shift width (sw3), the lower bit of the shift result at the time of the left logical shift is 0, and the shift result of the right logical shift The zero mask control unit 206c that generates an 8-bit zero mask (ZM3) for inserting zeros into the higher-order bits and the zero mask control unit 206 8 AND circuits 207 for calculating the logical product of the romask (ZM3) and the outputs of the 8 2to1 selectors 204.

シフト量制御部205c及びゼロマスク制御部206cは、ビット数の違いを除けば図27のシフト量制御部103、ゼロマスク制御部104とほぼ同様である。ただし、シフト量制御部205cは8個の2to1セレクタ204の制御信号(s3)のみを生成する点で、シフト量制御部103と異なる。また、図30には示していないが、8ビットバレルシフタ時にシフト量制御部205a、205bとゼロマスク制御部206a、206bとに入力するシフト方向(lr1、lr2)、シフト幅(sw1、sw2)、及びローテートフラグ(rot1、rot2)を、それぞれ8ビットバレルシフタのシフト方向(lr3)とシフト幅(sw3)とローテートフラグ(rot3)とに切り替えるセレクタを備えている。   The shift amount control unit 205c and the zero mask control unit 206c are substantially the same as the shift amount control unit 103 and the zero mask control unit 104 of FIG. 27 except for the difference in the number of bits. However, the shift amount control unit 205c is different from the shift amount control unit 103 in that only the control signals (s3) of the eight 2to1 selectors 204 are generated. Although not shown in FIG. 30, the shift direction (lr1, lr2), the shift width (sw1, sw2) input to the shift amount control units 205a, 205b and the zero mask control units 206a, 206b at the time of 8-bit barrel shifter, and A selector is provided for switching the rotation flag (rot1, rot2) to the shift direction (lr3), shift width (sw3) and rotation flag (rot3) of the 8-bit barrel shifter.

0段目及び1段目の各2to1セレクタ201、202内に追加された2to1セレクタ203は、前段の1〜2ビット離れた位置の2to1セレクタの出力(又は入力データ)の位置が、4ビットバレルシフタの時と8ビットバレルシフタの時とで異なるため、それらを選択するために追加されている。一方、2段目として追加された8個の2to1セレクタ204は、8ビットバレルシフタ時に必要となる4ビット離れた位置の4ビットバレルシフタのシフト結果を選択するために追加されている。   The 2to1 selector 203 added to the 0th stage and the 1st stage 2to1 selectors 201 and 202 is such that the position of the output (or input data) of the 2to1 selector at a position 1 to 2 bits away from the previous stage is a 4-bit barrel shifter. And 8 bit barrel shifter are added to select them. On the other hand, eight 2to1 selectors 204 added as the second stage are added to select the shift result of the 4-bit barrel shifter at a position 4 bits away, which is necessary for the 8-bit barrel shifter.

一般的に、M個のNビットバレルシフタを用いて、P(=M×N)ビットのバレルシフタを構成する場合には、(M×(N+log2N-1))個の2to1セレクタと、追加した2to1セレクタを制御するためのシフト量制御部と、Pビットのゼロマスクを生成するゼロマスク生成部と、ゼロマスクと追加した2to1セレクタの選択結果との論理積を計算するPビットのAND回路とが必要となる。
特許第3272724号公報 Matthew R. Pillmeier, atc,"Design Alternatives for Barrel Shifters", Proceedings of the SPIE, Vol.4791, pp.436-446, 2002 Intel.Corp,"IA-32 インテル アーキテクチャ ソフトウェア・デベロッパーズ・マニュアル 上巻:基本アーキテクチャ",http://download.intel.com/jp/developer/jpdoc/IA32_Arh_Dev_Man_Vol1_Online_i.pdf, 2004 ARM.Limited, "Cortex-A8 Technical Reference Manual", Rev.r1p1, http://infocenter.arm.com/help/topic/com.arm.doc.ddi0344b/DDI0344.pdf, 2006
Generally, when constructing a P (= M × N) -bit barrel shifter using M N-bit barrel shifters, (M × (N + log2N-1)) 2to1 selectors are added. A shift amount control unit for controlling the 2to1 selector, a zero mask generation unit that generates a P-bit zero mask, and a P-bit AND circuit that calculates the logical product of the zero mask and the added 2to1 selector selection result are required. Become.
Japanese Patent No. 3272724 Matthew R. Pillmeier, atc, "Design Alternatives for Barrel Shifters", Proceedings of the SPIE, Vol.4791, pp.436-446, 2002 Intel.Corp, "IA-32 Intel Architecture Software Developer's Manual Volume 1: Basic Architecture", http: //download.intel.com/jp/developer/jpdoc/IA32_Arh_Dev_Man_Vol1_Online_i.pdf, 2004 ARM.Limited, "Cortex-A8 Technical Reference Manual", Rev.r1p1, http://infocenter.arm.com/help/topic/com.arm.doc.ddi0344b/DDI0344.pdf, 2006

上記のように、複数(M:2以上の整数)個のN(2のべき乗)ビットバレルシフタを組み合わせ、ビット幅のより広いP(=M×N)ビットバレルシフタとして利用する実装が増えている。
一方で、このような実装とする場合には、図30に示したように、(M×(N+log2N-1))個の2to1セレクタと、追加した2to1セレクタを制御するためのシフト量制御部と、Pビットのゼロマスクを生成するゼロマスク制御部と、ゼロマスクと追加した2to1セレクタの選択結果との論理積を計算するPビットのAND回路とが必要となる。
As described above, there is an increasing number of implementations that combine a plurality (M: integer greater than or equal to 2) N (powers of 2) bit barrel shifters and use them as P (= M × N) bit barrel shifters with a wider bit width.
On the other hand, in such an implementation, as shown in FIG. 30, (M × (N + log2N-1)) 2to1 selectors and shift amount control for controlling the added 2to1 selectors Part, a zero mask control part for generating a P bit zero mask, and a P bit AND circuit for calculating the logical product of the zero mask and the selection result of the added 2to1 selector.

このため、複数個のバレルシフタを組み合わせて、ビット幅のより広いバレルシフタを作るための追加ハードウェアコストは、必ずしも安いとは言えない。また、組み合わせるバレルシフタの個数(M)や、ビット幅(N)が増えるに従って、追加ハードウェアコストがより高くなるという問題がある。   For this reason, it cannot be said that the additional hardware cost for making a barrel shifter with a wider bit width by combining a plurality of barrel shifters is necessarily low. Further, there is a problem that the additional hardware cost increases as the number of barrel shifters to be combined (M) and the bit width (N) increase.

昨今では、携帯電話端末を始めとするモバイル機器においても、様々なメディア処理を高速に処理することが求められており、非特許文献3に開示されるように、SSE(Streaming SIMD Extensions)と同様のSIMD(Single instruction multiple data)型の実行ユニットが取り入れられている。このようなモバイル機器では、ハードウェアコストを抑えるため、ひいては消費電力を下げるために、最小限のハードウェアで機器を構成する必要がある。このため、複数個のバレルシフタを組み合わせてビット幅のより広いバレルシフタを作る場合においても、追加で必要となるハードウェア数をできる限り少なく抑えることが求められている。   In recent years, mobile devices such as mobile phone terminals are also required to perform various media processing at high speed. As disclosed in Non-Patent Document 3, this is the same as SSE (Streaming SIMD Extensions). The SIMD (Single instruction multiple data) type execution unit is incorporated. In such a mobile device, it is necessary to configure the device with a minimum amount of hardware in order to reduce hardware costs and thus reduce power consumption. For this reason, even when a barrel shifter having a wider bit width is made by combining a plurality of barrel shifters, it is required to keep the number of additional hardware required as small as possible.

本発明は係る問題に鑑みてなされたものであり、複数(M:2以上の整数)個のN(2のべき乗)ビットバレルシフタに対して僅かなハードウェアを追加することで、ビット幅のより広いP(=M×N)ビットバレルシフタを低コストに実現したバレルシフタ装置及びバレルシフト方法を提供することを目的とする。   The present invention has been made in view of such a problem. By adding a small amount of hardware to a plurality (M: an integer greater than or equal to 2) N (powers of 2) bit barrel shifters, the bit width can be increased. It is an object of the present invention to provide a barrel shifter device and a barrel shift method that realize a wide P (= M × N) bit barrel shifter at low cost.

上記目的を達成するため、本発明は、第1の態様として、M個のN(2のべき乗)ビットバレルシフタを組み合わせによってP(=M×N)ビットのバレルシフトを行うバレルシフタ装置であって、P個のMto1セレクタと、シフト方向とシフト幅とに基づいて、各Mto1セレクタのセレクト信号を生成するシフト量制御部とを備え、下位K番目のMto1セレクタには、M個のNビットバレルシフタの下位(K mod N)ビット目のシフト結果が接続されており、シフト量制御部が生成した下位K番目のMto1セレクタのセレクト信号がLである場合に、下位K番目のMto1セレクタは、下位R(K/N≧Lの場合はR=K/N-L、K/N<Lの場合にはR=K/N-L+M)番目のNビットバレルシフタの下位(K mod N)番目のシフト結果を選択し、下位K番目のMto1セレクタの選択結果を、Pビットバレルシフタの下位Kビット目のシフト結果とすることを特徴とするバレルシフタ装置を提供するものである。   To achieve the above object, the present invention provides, as a first aspect, a barrel shifter device that performs barrel shift of P (= M × N) bits by combining M N (powers of 2) bit barrel shifters, And a shift amount control unit that generates a select signal of each Mto1 selector based on the shift direction and the shift width. The lower K-th Mto1 selector includes M N-bit barrel shifters. When the shift result of the lower (K mod N) bit is connected and the select signal of the lower Kth Mto1 selector generated by the shift amount control unit is L, the lower Kth Mto1 selector (R = K / NL if K / N ≧ L, R = K / N-L + M if K / N <L) Lower (K mod N) th shift result of the Nth bit barrel shifter And select the result of the lower Kth Mto1 selector as the P bit barrel shifter. There is provided a barrel shifter apparatus characterized by position to the shift result of K-th bit.

また、上記目的を達成するため、本発明は、第2の態様として、M個のN(2のべき乗)ビットバレルシフタを組み合わせによってP(=M×N)ビットのバレルシフトを行うバレルシフト方法であって、P個のMto1セレクタのうち下位K番目のセレクタに、M個のNビットバレルシフタの下位(K mod N)ビット目のシフト結果を接続し、シフト方向とシフト幅とに基づいて生成された下位K番目のMto1セレクタのセレクト信号がLである場合に、下位K番目のMto1セレクタによって下位R(K/N≧Lの場合はR=K/N-L、K/N<Lの場合にはR=K/N-L+M)番目のNビットバレルシフタの下位(K mod N)番目のシフト結果を選択し、下位K番目のMto1セレクタの選択結果を、Pビットバレルシフタの下位Kビット目のシフト結果とすることを特徴とするバレルシフト方法を提供するものである。   In order to achieve the above object, the present invention provides, as a second aspect, a barrel shift method for performing barrel shift of P (= M × N) bits by combining M N (power of 2) bit barrel shifters. The shift result of the lower (K mod N) bits of the M N-bit barrel shifters is connected to the lower K-th selector among the P Mto1 selectors, and is generated based on the shift direction and the shift width. When the select signal of the lower Kth Mto1 selector is L, the lower Kth Mto1 selector selects the lower R (if K / N ≧ L, R = K / NL, and K / N <L R = K / N-L + M) selects the lower (K mod N) th shift result of the Nth bit barrel shifter, and selects the lower Kth Mto1 selector as the lower Kth bit of the P bit barrel shifter. Providing a barrel shift method characterized by a shift result It is.

本発明によれば、複数(M:2以上の整数)個のN(2のべき乗)ビットバレルシフタに対して僅かなハードウェアを追加することで、ビット幅のより広いP(=M×N)ビットバレルシフタを低コストに実現したバレルシフタ装置及びバレルシフト方法を提供できる。   According to the present invention, P (= M × N) having a wider bit width can be obtained by adding a small amount of hardware to a plurality (M: an integer of 2 or more) N (power of 2) bit barrel shifters. It is possible to provide a barrel shifter device and a barrel shift method that realize a bit barrel shifter at low cost.

図1に示すように、本発明に係るバレルシフタ装置としてのPビットバレルシフタ10は、M個のN(2のべき乗)ビットバレルシフタ1を組み合わせによってP(=M×N)ビットのバレルシフトを行うバレルシフタ装置であって、P個のMto1セレクタ2と、シフト方向とシフト幅とに基づいて、各Mto1セレクタ2のセレクト信号を生成するシフト量制御部3とを備え、下位K番目のMto1セレクタ2には、M個のNビットバレルシフタ1の下位(K mod N)ビット目のシフト結果が接続されており、シフト量制御部3が生成した下位K番目のMto1セレクタ2のセレクト信号がLである場合に、下位K番目のMto1セレクタ2は、下位R(K/N≧Lの場合はR=K/N-L、K/N<Lの場合にはR=K/N-L+M)番目のNビットバレルシフタ1の下位(K mod N)番目のシフト結果を選択し、下位K番目のMto1セレクタ2の選択結果を、Pビットバレルシフタ10の下位Kビット目のシフト結果とすることを特徴とする。   As shown in FIG. 1, a P-bit barrel shifter 10 as a barrel shifter device according to the present invention performs a barrel shift of P (= M × N) bits by combining M N (powers of 2) bit barrel shifters 1. The device includes P Mto1 selectors 2 and a shift amount control unit 3 that generates a select signal of each Mto1 selector 2 based on the shift direction and the shift width. Is connected to the shift result of the lower (K mod N) bit of the M N-bit barrel shifters 1 and the select signal of the lower K-th Mto1 selector 2 generated by the shift amount control unit 3 is L In addition, the lower Kth Mto1 selector 2 has a lower R (R = K / NL if K / N ≧ L, R = K / N-L + M if K / N <L) th N Select the lower (K mod N) shift result of bit barrel shifter 1 and select the lower K number Mto1 selection result selector 2 and characterized by a shift result of the lower K-th bit of P-bit barrel shifter 10.

M個のNビットバレルシフタ1の境界で、1〜(N−1)ビット離れた位置のデータを選択するMto1セレクタ2への入力は、M個のNビットバレルシフタ時とPビットバレルシフタ時とでは異なるが、このような構成とすることにより、それらを選択するためにMto1セレクタを追加する必要がない。これにより、Nビットバレルシフタを複数組み合わせによってPビットバレルシフタを構成するにあたって、追加で必要となるハードウェア数を最小限に抑えることができる。   The input to the Mto1 selector 2 that selects data at positions 1 to (N-1) bits apart at the boundary of M N-bit barrel shifters 1 is different for M N-bit barrel shifters and P-bit barrel shifters. However, with such a configuration, it is not necessary to add an Mto1 selector to select them. This makes it possible to minimize the number of additional hardware required when configuring a P-bit barrel shifter by combining a plurality of N-bit barrel shifters.

以下、本発明の好適な実施の形態について説明する。   Hereinafter, preferred embodiments of the present invention will be described.

〔第1の実施形態〕
本発明を好適に実施した第1の実施形態について説明する。
図2に、本実施形態に係るPビットバレルシフタの構成を示す。バレルシフタ装置としてのPビットバレルシフタ300は、M(M:2以上の整数)個のN(2のべき乗)ビットバレルシフタ301を組み合わせることにより、ビット幅がP(=M×N)ビットとより広くなっている。
[First Embodiment]
A first embodiment in which the present invention is suitably implemented will be described.
FIG. 2 shows the configuration of the P-bit barrel shifter according to this embodiment. A P-bit barrel shifter 300 as a barrel shifter device has a wider bit width of P (= M × N) bits by combining M (M: integer greater than or equal to 2) N (power of 2) bit barrel shifters 301. ing.

ここで、図2に示す構成は、左シフトを基本(右シフトは左シフトを応用して実現)とするM個のNビットバレルシフタを用いた例であるが、右シフトを基本とする構成であっても良い。   Here, the configuration shown in FIG. 2 is an example using M N-bit barrel shifters based on the left shift (right shift is realized by applying the left shift). There may be.

Pビットバレルシフタ300は、M個のNビットバレルシフタ301に、P個のMto1セレクタ302と、シフト量制御部303と、ゼロマスク制御部304と、P個のAND回路305とを追加することによって構成されている。なお、Nビットバレルシフタ301は図1のNビットバレルシフタ1に相当する。また、P個のMto1セレクタ302は図1のMto1セレクタ2に相当する。さらに、シフト量制御部303は図1のシフト量制御部3に相当する。
シフト量制御部303は、Pビットバレルシフタ300のシフト方向(lrP, 左:1、右:0)とシフト量swP(P>swP≧0)とから、P個のMto1セレクタ302のセレクト信号を生成する。ゼロマスク制御部304は、Pビットバレルシフタ300のシフト方向(lrP)とシフト量(swP)とローテートフラグ(rotP)とから論理シフト時に利用するPビットのゼロマスクを生成する。AND回路305は、P個のMto1セレクタ302の選択結果とゼロマスクとの論理積を計算する。
The P-bit barrel shifter 300 is configured by adding P Mto1 selectors 302, a shift amount control unit 303, a zero mask control unit 304, and P AND circuits 305 to the M N-bit barrel shifters 301. ing. The N-bit barrel shifter 301 corresponds to the N-bit barrel shifter 1 in FIG. The P Mto1 selectors 302 correspond to the Mto1 selector 2 in FIG. Further, the shift amount control unit 303 corresponds to the shift amount control unit 3 in FIG.
The shift amount control unit 303 generates select signals for the P Mto1 selectors 302 from the shift direction (lrP, left: 1, right: 0) of the P-bit barrel shifter 300 and the shift amount swP (P> swP ≧ 0). To do. The zero mask control unit 304 generates a P bit zero mask used at the time of logical shift from the shift direction (lrP), the shift amount (swP), and the rotate flag (rotP) of the P bit barrel shifter 300. The AND circuit 305 calculates the logical product of the selection results of the P Mto1 selectors 302 and the zero mask.

図3に、Nビットバレルシフタ301の構成を示す。Nビットバレルシフタ301は、図27に示した4ビットバレルシフタをNビットに拡張した構成となっており、左右ローテートに加え、左右論理シフトを実行する。
Nビットバレルシフタ301は、2to1セレクタ3010、シフト量制御部3011、ゼロマスク制御部3012、及びAND回路3013を有する。
2to1セレクタ3010は、1段につきN個がQ(Q=[log2N]、[log2N]はlog2Nを超えない最大の整数)段カスケードされる。なお、図3においては、シフト量制御部3011と各段の2to1セレクタ3010との接続は省略している。
FIG. 3 shows the configuration of the N-bit barrel shifter 301. The N-bit barrel shifter 301 has a configuration in which the 4-bit barrel shifter shown in FIG. 27 is expanded to N bits, and performs a left-right logical shift in addition to a left-right rotation.
The N-bit barrel shifter 301 includes a 2to1 selector 3010, a shift amount control unit 3011, a zero mask control unit 3012, and an AND circuit 3013.
N 2 to 1 selectors 3010 are cascaded N (Q = [log2N], [log2N] is a maximum integer not exceeding log2N) stages per stage. In FIG. 3, the connection between the shift amount control unit 3011 and the 2to1 selector 3010 at each stage is omitted.

図4に、ゼロマスク制御部3012の構成を示す。ゼロマスク制御部3012は、Nビットバレルシフタのシフト方向(lr)とシフト幅(sw)とを基に、左論理シフト時のシフト結果の下位ビットの0を挿入するためのNビットの左ゼロマスク(LZM)と、右論理シフト時のシフト結果の上位ビットの0を挿入するためのNビットの右ゼロマスク(RZM)とを、ゼロマスク生成部3014によって生成する。そして、シフト方向(lr、左:1、右:0)に基づき、セレクタ3015により、左ゼロマスク(LZM)又は右ゼロマスク(RZM)を選択し、ローテートフラグ(rot、ローテート:1、論理シフト:0)に基づきセレクタ3016により、セレクタ3015の選択結果か、ローテート用の全ビットが1であるワンマスク(ONE)かを選択し、その選択結果をゼロマスクとして出力する。   FIG. 4 shows the configuration of the zero mask control unit 3012. The zero mask control unit 3012 uses an N-bit left zero mask (LZM) to insert a low-order bit 0 of the shift result in the left logical shift based on the shift direction (lr) and the shift width (sw) of the N-bit barrel shifter. ) And an N-bit right zero mask (RZM) for inserting the upper bit 0 of the shift result at the time of the right logical shift is generated by the zero mask generation unit 3014. Then, based on the shift direction (lr, left: 1, right: 0), the selector 3015 selects the left zero mask (LZM) or the right zero mask (RZM), and the rotate flag (rot, rotate: 1, logical shift: 0) ), The selector 3016 selects the selection result of the selector 3015 or the one mask (ONE) in which all the bits for rotation are 1, and outputs the selection result as a zero mask.

Pビットバレルシフタの基本動作原理について、2個の4ビットバレルシフタを組み合わせた8ビットバレルシフタを例に説明する。8ビットバレルシフタと、2個の4ビットバレルシフタのそれぞれとにおいて、abcdefghの8ビットデータを0〜7ビットだけ左ローテートした際のシフト結果と、2個の4ビットバレルシフタを組み合わせる際に利用するセレクト信号の様子とを図5に示す。   The basic operation principle of the P-bit barrel shifter will be described using an 8-bit barrel shifter in which two 4-bit barrel shifters are combined as an example. Select signal used when combining 8-bit barrel shifter and two 4-bit barrel shifters with the shift result when 8-bit data of abcdefgh is rotated left by 0-7 bits and two 4-bit barrel shifters This is shown in FIG.

セレクト信号は、2個の4ビットバレルシフタのシフト結果の一方を選択する8個のセレクタを制御する(図2のP個のMto1セレクタ302に相当)。下位0〜3ビット目のセレクタは、セレクト信号が0である場合には右側(自身)の4ビットバレルシフタのシフト結果をそれぞれ選択する。また、セレクト信号が1である場合には、左側(自身より一つ右側、この場合は左側に折り返し)の4ビットバレルシフトのシフト結果をそれぞれ選択する。   The select signal controls eight selectors for selecting one of the shift results of the two 4-bit barrel shifters (corresponding to P Mto1 selectors 302 in FIG. 2). When the select signal is 0, the selectors of the lower 0-3 bits respectively select the shift result of the right (self) 4-bit barrel shifter. When the select signal is 1, the shift result of the 4-bit barrel shift on the left side (one right side of itself, in this case folded back to the left side) is selected.

一方、下位4〜7ビット目のセレクタは、セレクト信号が0である場合には、左側(自身)の4ビットバレルシフタのシフト結果をそれぞれ選択する。また、セレクト信号が1である場合には、右側(自身より一つ右側)の4ビットバレルシフタのシフト結果をそれぞれ選択する。   On the other hand, when the select signal is 0, the lower fourth to seventh bit selectors respectively select the shift result of the left (self) 4-bit barrel shifter. When the select signal is 1, the shift result of the right side (one right side of itself) 4-bit barrel shifter is selected.

図5では、左ローテートを基本とするバレルシフタの組み合わせているため、セレクト信号が1である場合は、自身よりも一つ右側のバレルシフタのシフト結果を選択しているが、右ローテートを基本とするバレルシフタを組み合わせる場合には、自身よりも一つ左側のバレルシフタのシフト結果を選択する。   In FIG. 5, since the barrel shifter based on the left rotation is combined, when the select signal is 1, the shift result of the barrel shifter on the right one side from itself is selected, but the right rotation is the basis. When combining barrel shifters, the shift result of the barrel shifter on the left side of itself is selected.

また、図5では、2個の4ビットバレルシフタを組み合わせているが、例えばM個のNビットバレルシフタを組み合わせる場合では、セレクト信号をS(=[log2M])ビットに拡張する。   In FIG. 5, two 4-bit barrel shifters are combined. However, for example, when M N-bit barrel shifters are combined, the select signal is expanded to S (= [log2M]) bits.

そして、セレクト信号が0である場合には自身のバレルシフタのシフト結果を、セレクト信号がL(M>L≧0)である場合にはL個右側のバレルシフタのシフト結果を選択するように拡張する。ただし、L個右側のバレルシフタが存在しない場合には、右側のバレルシフタから左側のバレルシフタへ折り返して(右端のバレルシフタの右隣には左端のバレルシフタがあると仮定して)、L個目のバレルシフタのシフト結果を選択する。   When the select signal is 0, the shift result of its own barrel shifter is expanded, and when the select signal is L (M> L ≧ 0), the shift result of the L right barrel shifter is selected. . However, if there is no L right barrel shifter, the right barrel shifter is folded back to the left barrel shifter (assuming there is a left end barrel shifter right next to the right end barrel shifter) and the Lth barrel shifter Select the shift result.

図5に示すように、左0ビットシフト時には、2個の4ビットバレルシフタのシフト結果は、8ビットバレルシフタのシフト結果と一致するため、2個の4ビットバレルシフタシフト結果をそのまま8ビットバレルシフタのシフト結果として選択すれば良く、各ビット位置におけるセレクト信号は、0000|0000となる。   As shown in FIG. 5, at the time of left 0-bit shift, the shift results of the two 4-bit barrel shifters match the shift results of the 8-bit barrel shifter, so the two 4-bit barrel shifter shift results are directly shifted by the 8-bit barrel shifter. The selection may be made as a result, and the select signal at each bit position is 0000 | 0000.

左1ビットシフト時には、2個の4ビットバレルシフタのシフト結果のうち、それぞれの下位3〜1ビット目(bcd、fgh)は、8ビットバレルシフタのシフト結果と一致する。一方で、それぞれの下位0ビット目(a、e)を8ビットバレルシフタのシフト結果と一致させるためには、それぞれの下位0ビット目(a、e)を交換する必要がある。   At the time of left 1-bit shift, the lower 3rd to 1st bits (bcd, fgh) of the shift results of two 4-bit barrel shifters coincide with the shift results of the 8-bit barrel shifter. On the other hand, in order to make each lower 0 bit (a, e) coincide with the shift result of the 8-bit barrel shifter, it is necessary to exchange each lower 0 bit (a, e).

具体的には、左の4ビットバレルシフタの下位0ビット目(a)を、右の4ビットバレルシフタの下位0ビット目として選択し、右の4ビットバレルシフタの下位0ビット目(e)を、左の4ビットバレルシフタの下位0ビット目として選択すればよい。このためには、各ビット位置におけるセレクト信号は、0001|0001となる。   Specifically, the lower 0 bit (a) of the left 4-bit barrel shifter is selected as the lower 0 bit of the right 4-bit barrel shifter, and the lower 0 bit (e) of the right 4-bit barrel shifter is The lower 0 bit of the 4-bit barrel shifter may be selected. For this purpose, the select signal at each bit position is 0001 | 0001.

左2ビットシフト時には、2個の4ビットバレルシフタのシフト結果のうち、それぞれの下位3〜2ビット目(cd、gh)は、8ビットバレルシフタのシフト結果と一致する。一方で、それぞれの下位1〜0ビット目(ab、ef)を、それぞれ交換する必要がある。   During the left 2-bit shift, the lower 3rd to 2nd bits (cd, gh) of the shift results of the two 4-bit barrel shifters coincide with the shift results of the 8-bit barrel shifter. On the other hand, it is necessary to exchange each lower 1 to 0th bit (ab, ef).

具体的には、左の4ビットバレルシフタの下位1〜0ビット目(ab)を、右の4ビットバレルシフタの下位1〜0ビット目として選択し、右の4ビットバレルシフタの下位1〜0ビット目(ef)を、左の4ビットバレルシフタの下位1〜0ビット目として選択すればよい。このためには、各ビット位置におけるセレクト信号は、0011|0011となる。   Specifically, the lower 1 to 0 bits (ab) of the left 4-bit barrel shifter are selected as the lower 1 to 0 bits of the right 4-bit barrel shifter, and the lower 1 to 0 bits of the right 4-bit barrel shifter (ef) may be selected as the lower 1 to 0th bits of the left 4-bit barrel shifter. For this purpose, the select signal at each bit position is 0011 | 0011.

以下同様に、2個の4ビットバレルシフタのシフト結果を、図5のセレクト信号に基づいて選択することにより、8ビットバレルシフタを実現する。また、2個の4ビットバレルシフタに供給するセレクト信号は、同様の信号となっており、一つの4ビットセレクト信号を、2個の4ビットバレルシフタのシフト結果を選択するセレクタへ分配すればよい。   Similarly, an 8-bit barrel shifter is realized by selecting the shift results of two 4-bit barrel shifters based on the select signal shown in FIG. The select signals supplied to the two 4-bit barrel shifters are similar signals, and one 4-bit select signal may be distributed to selectors that select the shift results of the two 4-bit barrel shifters.

以下では、図5の例で説明した基本動作原理を実装し、一般化した図2のPビットバレルシフタ300の詳細について説明する。
まず、M個のNビットバレルシフタ301のシフト結果と、P個のMto1セレクタ302との接続方法について説明する。
下位K(P>K≧0)番目のMto1セレクタには、M個の各ビットバレルシフタの下位(K%N、%:剰余)ビット目のシフト結果が接続され、K番目のMto1セレクタのセレクト信号がL(M>L≧0)である場合に、下位K番目のMto1セレクタは、下位S(S=K/N-L、S<0となる場合にはS=K/N-L+M)番目のNビットバレルシフタの下位(K%N)番目のシフト結果を選択する。
In the following, the details of the generalized P-bit barrel shifter 300 of FIG. 2 that implements the basic operating principle described in the example of FIG. 5 will be described.
First, a method for connecting the shift results of the M N-bit barrel shifters 301 and the P Mto1 selectors 302 will be described.
The lower K (P> K ≧ 0) Mto1 selector is connected to the shift result of the lower (K% N,%: remainder) bits of each of the M bit barrel shifters, and the select signal of the Kth Mto1 selector Is L (M> L ≧ 0), the lower Kth Mto1 selector is lower S (S = K / NL, if S <0, S = K / N-L + M) th The lower (K% N) th shift result of the N-bit barrel shifter is selected.

図2におけるK(K=P-1)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-2)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位0番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択する。   Taking the K (K = P−1) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower order (N− 1) Select the shift result of the bit, and if the select signal L is 1, select the shift result of the lower (N-1) th bit of the lower (M-2) th N-bit barrel shifter and select When the signal L is (M−1), the lower (N−1) -th bit shift result of the lower 0th N-bit barrel shifter is selected.

図2におけるK(K=P-2)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-2)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位0番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択する。   Taking the K (K = P-2) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower order (N− 2) Select the shift result of the bit, and if the select signal L is 1, select the shift result of the lower (N-2) th bit of the lower (M-2) th N-bit barrel shifter and select When the signal L is (M−1), the shift result of the lower (N−2) th bit of the lower 0th N-bit barrel shifter is selected.

図2におけるK(K=P-N-1)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位(M-2)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-3)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択する。   Taking the K (K = PN-1) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower order (N− 1) Select the shift result of the bit, and if the select signal L is 1, select the shift result of the lower (N-1) th bit of the lower (M-3) th N-bit barrel shifter and select When the signal L is (M−1), the lower (N−1) -th bit shift result of the lower (M−1) -th N-bit barrel shifter is selected.

図2におけるK(K=P-N-2)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位(M-2)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-3)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択する。   Taking the K (K = PN-2) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower order (N− 2) Select the shift result of the bit, and if the select signal L is 1, select the shift result of the lower (N-2) th bit of the lower (M-3) th N-bit barrel shifter and select When the signal L is (M-1), the lower (N-2) -th bit shift result of the lower (M-1) -th N-bit barrel shifter is selected.

図2におけるK(K=N-1)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位0番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが(M-2)である場合には、下位2番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位1番目のNビットバレルシフタの下位(N-1)ビット目のシフト結果を選択する。   Taking the K (K = N-1) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower (N-1) th bit of the lower 0th N-bit barrel shifter If the select signal L is 1, the lower (M−1) th N-bit barrel shifter lower (N−1) bit shift result is selected and the select signal L is ( M-2), the shift result of the lower (N-1) th bit of the lower second N-bit barrel shifter is selected, and when the select signal L is (M-1), the lower 1 The shift result of the lower (N-1) th bit of the Nth N-bit barrel shifter is selected.

図2におけるK(K=N-2)番目のMto1セレクタを例とすると、Mto1セレクタのセレクト信号Lが0である場合には、下位0番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが1である場合には、下位(M-1)番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが(M-2)である場合には、下位2番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択し、セレクト信号Lが(M-1)である場合には、下位1番目のNビットバレルシフタの下位(N-2)ビット目のシフト結果を選択する。   Taking the K (K = N-2) th Mto1 selector in FIG. 2 as an example, when the select signal L of the Mto1 selector is 0, the lower (N-2) th bit of the lower 0th N-bit barrel shifter If the select signal L is 1, the lower (M−1) th N-bit barrel shifter lower (N−2) -bit shift result is selected, and the select signal L is ( M-2), the shift result of the lower (N-2) bit of the lower second N-bit barrel shifter is selected, and when the select signal L is (M-1), the lower 1 The shift result of the lower (N-2) th bit of the Nth N-bit barrel shifter is selected.

次に、シフト量制御部303によって生成される、P個のMto1セレクタ302の各セレクト信号L(M>L≧0)について説明する。ここで、セレクト信号Lは、H(=[log2M])ビットからなる信号である。   Next, each select signal L (M> L ≧ 0) of the P Mto1 selectors 302 generated by the shift amount control unit 303 will be described. Here, the select signal L is a signal composed of H (= [log2M]) bits.

図5を用いて説明したように、図2に示すP個のMto1セレクタ302のうち、M個のバレルシフタが直下にあるN個ずつのMto1セレクタには、共通のNセットのセレクト信号Lを分配すればよい。   As described with reference to FIG. 5, among the M Mto1 selectors 302 shown in FIG. 2, N sets of select signals L are distributed to N Mto1 selectors immediately below the M barrel shifters. do it.

一般的には、下位K(P>K≧0)番目のMto1セレクタのうち、(K%N)が同一であるMto1セレクタには、同一のセレクト信号Lを分配する。   Generally, the same select signal L is distributed to the Mto1 selectors having the same (K% N) among the lower K (P> K ≧ 0) Mto1 selectors.

Nセットのセレクト信号Lを、Pビットバレルシフタのシフト方向(lrP)とシフト量swP(P>swP≧0)とから直接生成するのではなく、Nビットバレルシフタのゼロマスク生成部3012が生成するゼロマスクを流用することにより、Nセットのセレクト信号Lを生成するハードウェアコストを低減する。   Instead of directly generating the N sets of select signals L from the shift direction (lrP) of the P-bit barrel shifter and the shift amount swP (P> swP ≧ 0), the zero mask generated by the zero mask generation unit 3012 of the N-bit barrel shifter is generated. By diverting, the hardware cost for generating N sets of select signals L is reduced.

以下では、Nセットのセレクト信号Lの規則性について説明し、その一部がNビットバレルシフタのゼロマスク制御部3012が生成するゼロマスクと同等であることを説明する。そして、Nセットのセレクト信号Lの生成方法について説明する。   In the following, the regularity of the N sets of select signals L will be described, and a part thereof will be described as being equivalent to the zero mask generated by the zero mask control unit 3012 of the N-bit barrel shifter. A method for generating N sets of select signals L will be described.

図6に、8個の4ビットバレルシフタを組み合わせる場合に、左ローテート(シフト)時にシフト量制御部303が生成するNセットのセレクト信号Lを示す。また、図7に、Nビットバレルシフタ301で左ローテート(シフト)時に生成される右ゼロマスク(RZM)と左ゼロマスク(LZM)とを示す。   FIG. 6 shows N sets of select signals L generated by the shift amount control unit 303 at the time of left rotation (shift) when eight 4-bit barrel shifters are combined. FIG. 7 shows a right zero mask (RZM) and a left zero mask (LZM) generated when the N-bit barrel shifter 301 is rotated left (shifted).

図6に示すように、8個の4ビットバレルシフタを組み合わせるため、4セットのセレクト信号が生成される。各セレクト信号は、8個の4ビットバレルシフタのシフト結果を選択するため、各3bit必要である。また、4セットのセレクト信号の各下位2ビット目、各下位1ビット目、各下位0ビット目を取り出したビット列を表の右側にまとめる。   As shown in FIG. 6, four sets of select signals are generated in order to combine eight 4-bit barrel shifters. Each select signal requires 3 bits for selecting the shift result of eight 4-bit barrel shifters. Also, the bit strings obtained by extracting the lower 2 bits, the lower 1 bits, and the lower 0 bits of the four sets of select signals are collected on the right side of the table.

図6、図7を参照すると、図6の縦線部は右ゼロマスクRZMと、図6の網掛け部は左ゼロマスクLZMとそれぞれ同じビットパターンとなっている。よって、図7の4ビットバレルシフタが生成する左右ゼロマスク(LZM、RZM)を左ローテート(シフト)時のセレクト信号Lの生成に利用する。   Referring to FIGS. 6 and 7, the vertical line portion in FIG. 6 has the same bit pattern as the right zero mask RZM, and the shaded portion in FIG. 6 has the same bit pattern as the left zero mask LZM. Therefore, the left and right zero masks (LZM, RZM) generated by the 4-bit barrel shifter in FIG. 7 are used for generating the select signal L at the left rotation (shift).

図6の例では、セレクト信号Lの下位0ビット目を生成するのに、シフト量の下位2ビット目(swP[2])が0である場合には右ゼロマスク(RZM)を選択し、シフト量の下位2ビット目(swP[2])が1である場合には左ゼロマスク(LZM)を選択する。   In the example of FIG. 6, to generate the lower 0 bit of the select signal L, if the lower 2nd bit (swP [2]) of the shift amount is 0, the right zero mask (RZM) is selected and shifted. When the lower 2nd bit (swP [2]) of the quantity is 1, the left zero mask (LZM) is selected.

一般化すると、Pビットバレルシフタが左にswP(P>swP≧0)ビットシフトする際に、下位K(P>K≧0)番目のMto1セレクタのセレクト信号の下位0ビット目として、シフト量swPの下位Q(=[log2N])ビット目が0である場合には、任意のNビットバレルシフタの左右ゼロマスクセレクタを用いて選択した右ゼロマスク(RZM)の下位(K%N)ビット目を選択する。シフト量swPの下位Qビット目が1である場合には、下位K(P>K≧0)番目のMto1セレクタのセレクト信号の下位0ビット目として、任意のNビットバレルシフタの左右ゼロマスクセレクタを用いて選択した左ゼロマスク(LZM)の下位(K%N)ビット目を選択する。   In general, when the P-bit barrel shifter shifts swP (P> swP ≧ 0) bits to the left, the shift amount swP is used as the lower 0th bit of the select signal of the lower K (P> K ≧ 0) Mto1 selector. When the low-order Q (= [log2N]) bit of 0 is 0, the low-order (K% N) bit of the right zero mask (RZM) selected using the left and right zero mask selectors of any N-bit barrel shifter is selected. . When the lower Q bit of the shift amount swP is 1, the left and right zero mask selector of any N-bit barrel shifter is used as the lower 0 bit of the select signal of the lower K (P> K ≧ 0) Mto1 selector The lower (K% N) bit of the left zero mask (LZM) selected in the above is selected.

RZMかLZMかの選択は、図8に示すように、Nビットバレルシフタのゼロマスク制御部が持っているRZMかLZMかを選択するための左右ゼロマスクセレクタ400のセレクト信号を、シフト量swPの下位Qビット目に切り替えるためのセレクタ402を図4に示した構成に追加するだけでよい。また、セレクタ402は、Pビットバレルシフタ実行時に1となるmode信号によって切り替えられる。   As shown in FIG. 8, the selection of RZM or LZM is performed by using the select signal of the left and right zero mask selector 400 for selecting RZM or LZM of the zero mask control unit of the N-bit barrel shifter as the lower Q of the shift amount swP. It is only necessary to add a selector 402 for switching to the bit to the configuration shown in FIG. The selector 402 is switched by a mode signal that becomes 1 when the P-bit barrel shifter is executed.

図6の例では、セレクト信号Lの下位1ビット目を生成するのに、シフト量の下位3〜2ビット目(swP[3:2])が00である場合には0000を選択し、シフト量の下位3〜2ビット目(swP[3:2])が01である場合にはRZMを選択し、シフト量の下位3〜2ビット目(swP[3:2])が10である場合には1111を選択し、シフト量の下位3〜2ビット目(swP[3:2])が11である場合にはLZMを選択する。これらの選択には、4個の4to1セレクタを実装し、swP[3:2]をそのセレクト信号として利用するだけで良い。   In the example of FIG. 6, when the lower third bit of the shift amount (swP [3: 2]) is 00 to generate the lower first bit of the select signal L, 0000 is selected and shifted. RZM is selected when the lower 3rd and 2nd bits (swP [3: 2]) of the amount is 01, and the lower 3rd and 2nd bits (swP [3: 2]) of the shift amount are 10. 1111 is selected and LZM is selected when the lower 3rd and second bits (swP [3: 2]) of the shift amount is 11. For these selections, four 4to1 selectors are mounted and swP [3: 2] only needs to be used as the selection signal.

図6の例では、セレクト信号Lの下位2ビット目を生成するのに、シフト量の下位3〜2ビット目(swP[3:2])の論理積の結果をResAとして、シフト量の下位4ビット目(swP[4])とResAが00である場合には0000を選択し、シフト量の下位4ビット目(swP[4])とResAが01である場合にはRZMを選択し、シフト量の下位4ビット目(swP[4])とResAが10である場合には1111を選択し、シフト量の下位4ビット目(swP[4])とResAが11である場合にはLZMを選択する。   In the example of FIG. 6, in order to generate the lower second bit of the select signal L, the logical product of the lower third to second bits (swP [3: 2]) of the shift amount is ResA, and the lower shift amount If the 4th bit (swP [4]) and ResA are 00, select 0000; if the lower 4th bit of the shift amount (swP [4]) and ResA are 01, select RZM; If the lower 4th bit of the shift amount (swP [4]) and ResA are 10, 1111 is selected, and if the lower 4th bit of the shift amount (swP [4]) and ResA is 11, LZM is selected. Select.

一般化すると、Pビットバレルシフタが左にswP(P>swP≧0)ビットシフトする際に、下位K番目のMto1セレクタのセレクト信号の下位T(Q>T>0)ビット目は、シフト量swPの下位Q(=[log2N])ビット目から、下位(Q+T-1)ビット目までのビット値の論理積の結果をResAとして、ResAと下位(Q+T)ビット目が00である場合には全ビット0(ZERO)を選択し、ResAと下位(Q+T)ビット目が01である場合にはRZMを選択し、ResAと下位(Q+T)ビット目が10である場合には全ビット1(ONE)を選択し、ResAと下位(Q+T)ビット目が11である場合にはLZMを選択する。   In general, when the P-bit barrel shifter shifts swP (P> swP ≧ 0) bits to the left, the lower T (Q> T> 0) bit of the select signal of the lower Kth Mto1 selector is the shift amount swP The result of the logical product of the bit values from the lower Q (= [log2N]) bit to the lower (Q + T-1) bit is ResA, and ResA and the lower (Q + T) bit are 00 When all bits 0 (ZERO) are selected, when ResA and the lower (Q + T) bit are 01, RZM is selected, and when ResA and the lower (Q + T) bit are 10, In this case, all bits 1 (ONE) are selected, and if ResA and the lower (Q + T) bit are 11, LZM is selected.

セレクト信号Lの下位(H-1)(H=[log2M])〜0ビット目の生成は、図9に示すように、ResAを生成するT(H>T≧1)ビット入力のAND素子403と、N個の4to1セレクタ404を(H-1)組実装し、sw[Q+T]とResAをそのセレクト信号として実装することにより実現する。   As shown in FIG. 9, the lower (H-1) (H = [log2M]) to 0th bit of the select signal L is generated by an AND element 403 with a T (H> T ≧ 1) bit input for generating ResA. This is realized by mounting (H−1) sets of N 4to1 selectors 404 and sw [Q + T] and ResA as the select signals.

シフト量制御部303が利用するゼロマスク(LZM、RZM)は、M個のNビットバレルシフタの任意の一つであればよい。なお、図2においては、シフト量制御部303とNビットバレルシフタ301間でのゼロマスクや制御の配線は明示していない。   The zero mask (LZM, RZM) used by the shift amount control unit 303 may be any one of M N-bit barrel shifters. In FIG. 2, the zero mask and control wiring between the shift amount control unit 303 and the N-bit barrel shifter 301 are not clearly shown.

図10に、8個の4ビットバレルシフタを組み合わせる場合に、右ローテート(シフト)時にシフト量制御部303が生成するNセットのセレクト信号Lを示す。また、図11に、Nビットバレルシフタ301で、右ローテート(シフト)時に生成される右ゼロマスク(RZM)と左ゼロマスク(LZM)とを示す。   FIG. 10 shows N sets of select signals L generated by the shift amount control unit 303 at the time of right rotation (shift) when eight 4-bit barrel shifters are combined. FIG. 11 shows a right zero mask (RZM) and a left zero mask (LZM) generated by the N-bit barrel shifter 301 at the time of right rotation (shift).

図10に示すように、8個の4ビットバレルシフタを組み合わせるため、4セットのセレクト信号が生成される。各セレクト信号は、8個の4ビットバレルシフタのシフト結果を選択するため、各3bit必要である。また、4セットのセレクト信号の各下位2ビット目、各下位1ビット目、各下位0ビット目を取り出したビット列を表の右側にまとめる。   As shown in FIG. 10, four sets of select signals are generated in order to combine eight 4-bit barrel shifters. Each select signal requires 3 bits each for selecting the shift result of eight 4-bit barrel shifters. Also, the bit strings obtained by extracting the lower 2 bits, the lower 1 bits, and the lower 0 bits of the four sets of select signals are collected on the right side of the table.

図10、図11を参照すると、図10の縦線部は右ゼロマスク(RZM)と、図10の網掛け部は左ゼロマスク(LZM)とそれぞれ同じビットパターンとなっている。よって、4ビットバレルシフタが生成するゼロマスク(RZM、LZM)を、右ローテート(シフト)時のセレクト信号Lの生成に利用する。   10 and 11, the vertical line portion in FIG. 10 has the same bit pattern as the right zero mask (RZM), and the shaded portion in FIG. 10 has the same bit pattern as the left zero mask (LZM). Therefore, the zero mask (RZM, LZM) generated by the 4-bit barrel shifter is used to generate the select signal L at the time of right rotation (shift).

図10の例では、セレクト信号Lの下位0ビット目を生成するのに、シフト量の下位2ビット目(swP[2])が0である場合には、左ゼロマスク(LZM)を選択し、シフト量の下位2ビット目(swP[2])が1である場合には右ゼロマスク(RZM)を選択する。   In the example of FIG. 10, when the lower second bit (swP [2]) of the shift amount is 0 to generate the lower 0 bit of the select signal L, the left zero mask (LZM) is selected, When the lower second bit (swP [2]) of the shift amount is 1, the right zero mask (RZM) is selected.

一般化すると、Pビットバレルシフタが右にswP(P>swP≧0)ビットシフトする際に、下位K(P>K≧0)番目のMto1セレクタのセレクト信号の下位0ビット目として、シフト量swPの下位Q(=[log2N])ビット目が0である場合には、任意のNビットバレルシフタの左右ゼロマスクセレクタを用いて選択した左ゼロマスク(LZM)の下位(K%N)ビット目を選択する。シフト量swPの下位Qビット目が1である場合には、下位K番目のMto1セレクタのセレクト信号の下位0ビット目として、任意のNビットバレルシフタの左右ゼロマスクセレクタを用いて選択した右ゼロマスク(RZM)の下位(K%N)ビット目を選択する。   Generally, when the P-bit barrel shifter shifts swP (P> swP ≧ 0) bits to the right, the shift amount swP is used as the lower 0th bit of the select signal of the lower K (P> K ≧ 0) Mto1 selector. When the low-order Q (= [log2N]) bit of 0 is 0, the low-order (K% N) bit of the left zero mask (LZM) selected using the left and right zero mask selectors of any N-bit barrel shifter is selected. . When the lower Q bit of the shift amount swP is 1, the right zero mask (RZM) selected using the left and right zero mask selectors of any N-bit barrel shifter is used as the lower 0 bit of the select signal of the lower K-th Mto1 selector. ) The lower (K% N) bit is selected.

RZMとLZMとの選択は、図12に示すように、図8に示した左ローテート(シフト)時のRZMとLZMとの選択回路を拡張したものとなる。シフト量swPの下位Qビット目と、Pビットバレルシフタのシフト方向(lrP)との否定排他的論理和(XNOR)503を計算し、Nビットバレルシフタが持っているRZMとLZMとを選択するための左右ゼロマスクセレクタ501のセレクト信号を否定排他的論理和503に切り替えるためのセレクタ502が必要となる。また、セレクタ501は、Pビットバレルシフタ実行時に1となるmode信号によって切り替えられる。   As shown in FIG. 12, the selection of RZM and LZM is an extension of the selection circuit for RZM and LZM during left rotation (shift) shown in FIG. To calculate the negative exclusive OR (XNOR) 503 of the lower Q bits of the shift amount swP and the shift direction (lrP) of the P bit barrel shifter, and to select RZM and LZM that the N bit barrel shifter has A selector 502 for switching the select signal of the left and right zero mask selector 501 to the negative exclusive OR 503 is required. The selector 501 is switched by a mode signal that becomes 1 when the P-bit barrel shifter is executed.

図10の例では、セレクト信号Lの下位1ビット目を生成するのに、シフト量の下位3〜2ビット目(swP[3:2])が00である場合には0000を選択し、シフト量の下位3〜2ビット目(swP[3:2])が01である場合にはLZMを選択し、シフト量の下位3〜2ビット目(swP[3:2])が10である場合には1111を選択し、シフト量の下位3〜2ビット目(swP[3:2])が11である場合にはRZMを選択する。これらの選択には、4個の4to1セレクタを実装し、swP[3:2]をそのセレクト信号として利用するだけでよい。   In the example of FIG. 10, when the lower 3rd and 2nd bits (swP [3: 2]) of the shift amount are 00 to generate the lower 1st bit of the select signal L, 0000 is selected and shifted. LZM is selected when the lower 3rd and 2nd bits (swP [3: 2]) of the amount is 01, and the lower 3rd and 2nd bits (swP [3: 2]) of the shift amount are 10. 1111 is selected, and when the third and second bits (swP [3: 2]) of the shift amount is 11, RZM is selected. For these selections, it is only necessary to implement four 4to1 selectors and use swP [3: 2] as the selection signal.

図10の例では、セレクト信号Lの下位2ビット目を生成するのに、シフト量の下位3〜2ビット目(swP[3:2])の論理積の結果をResAとして、シフト量の下位4ビット目(swP[4])とResAが00である場合には0000を選択し、シフト量の下位4ビット目(swP[4])とResAが01である場合にはLZMを選択し、シフト量の下位4ビット目(swP[4])とResAが10である場合には1111を選択し、シフト量の下位4ビット目(swP[4])とResAが11である場合にはRZMを選択する。   In the example of FIG. 10, in order to generate the lower 2 bits of the select signal L, the logical product of the lower 3rd to 2nd bits (swP [3: 2]) of the shift amount is ResA, and the lower shift bit is generated. If the fourth bit (swP [4]) and ResA are 00, select 0000; if the lower 4th bit of the shift amount (swP [4]) and ResA are 01, select LZM; When the lower 4th bit of the shift amount (swP [4]) and ResA are 10, 1111 is selected, and when the lower 4th bit of the shift amount (swP [4]) and ResA are 11, RZM Select.

一般化すると、Pビットバレルシフタが右にswPビットシフトする際に、下位K番目のMto1セレクタのセレクト信号の下位Tビット目は、シフト量swPの下位Q(=[log2N])ビット目から、下位(Q+T-1)ビット目までのビットの論理積の結果をResAとして、ResAと下位(Q+T)ビット目が00である場合には全ビット0(ZERO)を選択し、ResAと下位(Q+T)ビット目が01である場合にはLZNを選択し、ResAと下位(Q+T)ビット目が10である場合には全ビット1(ONE)を選択し、ResAと下位(Q+T)ビット目が11である場合にはRZMを選択する。   In general, when the P-bit barrel shifter shifts swP bits to the right, the lower T bit of the select signal of the lower Kth Mto1 selector is lower than the lower Q (= [log2N]) bits of the shift amount swP. If the result of the logical product of the bits up to the (Q + T-1) bit is ResA, if ResA and the lower (Q + T) bit are 00, all bits 0 (ZERO) are selected, and ResA and When the lower (Q + T) bit is 01, LZN is selected. When ResA and the lower (Q + T) bit are 10, all bits 1 (ONE) are selected, and ResA and lower When the (Q + T) bit is 11, RZM is selected.

セレクト信号Lの下位(H-1)(H=[log2M])〜0ビット目の生成は、図13に示すように、図9に示した左ローテート(シフト)時のRZMとLZMとの選択回路を拡張することによって実現する。Pビットバレルシフタのシフト方向(lrP)に基づき、[swP[Q+T],ResA]より生成される選択信号(Sel4[1:0])を切り替える。具体的には、シフト方向が左である場合には直線の矢印でSel4を生成し、シフト方向が右である場合にはクロスする矢印でSel4を生成する。   As shown in FIG. 13, the lower (H-1) (H = [log2M]) to 0th bit of the select signal L is generated by selecting the RZM and LZM during the left rotation (shift) shown in FIG. This is achieved by extending the circuit. Based on the shift direction (lrP) of the P-bit barrel shifter, the selection signal (Sel4 [1: 0]) generated from [swP [Q + T], ResA] is switched. Specifically, when the shift direction is left, Sel4 is generated with a straight arrow, and when the shift direction is right, Sel4 is generated with a crossing arrow.

図13に示すように、図9のResAを生成するTビット入力のAND素子504と、(H-1)組のN個の4to1セレクタ505に、シフト量swPの下位(Q+T)ビット目とResAとから、N個の4to1セレクタ505の制御信号(sel4)を生成するデコーダ506とを加えることにより、セレクト信号Lの下位(H-1)〜0ビット目を生成する。   As shown in FIG. 13, a T bit input AND element 504 for generating ResA in FIG. 9 and (H−1) sets of N 4to1 selectors 505 include the lower (Q + T) bit of the shift amount swP. And ResA are added with a decoder 506 that generates a control signal (sel4) of N 4to1 selectors 505, thereby generating lower (H-1) to 0th bits of the select signal L.

次に、Pビットバレルシフタ300のシフト方向(lrP)とシフト量(swP)とローテートフラグ(rotP)とから論理シフト時に利用するPビットのゼロマスクを生成するゼロマスク制御部304について説明する。   Next, the zero mask control unit 304 that generates a P bit zero mask used at the time of logical shift from the shift direction (lrP), the shift amount (swP), and the rotation flag (rotP) of the P bit barrel shifter 300 will be described.

図14に、ゼロマスク制御部304の構成を示す。ゼロマスク制御部304は、Pビットバレルシフタのシフト方向(lrP)とシフト量(swP)とから、左ゼロマスク(LZM)と右ゼロマスク(RZM)とを生成するゼロマスク生成部600と、生成されたゼロマスク(LZM、RZM)をシフト方向lrPに基づき選択する左右ゼロマスクセレクタ601と、ローテートフラグrotPに基づき選択結果又は全ビットマスク(ONE)を選択するシフトマスクセレクタ602とから構成される。
ゼロマスク制御部304は、シフトマスクセレクタ602の選択結果をゼロマスク(ZMP)として、P個のMto1セレクタ302の選択結果との論理和をAND回路305によって計算し、最終的なPビットバレルシフタのシフト結果(Out)を得る。
FIG. 14 shows the configuration of the zero mask control unit 304. The zero mask control unit 304 generates a left zero mask (LZM) and a right zero mask (RZM) from the shift direction (lrP) and shift amount (swP) of the P-bit barrel shifter, and the generated zero mask ( The left and right zero mask selectors 601 that select LZM and RZM) based on the shift direction lrP, and the shift mask selector 602 that selects the selection result or all bit masks (ONE) based on the rotate flag rotP.
The zero mask control unit 304 uses the selection result of the shift mask selector 602 as a zero mask (ZMP), calculates a logical sum with the selection results of the P Mto1 selectors 302 by the AND circuit 305, and finally shifts the P bit barrel shifter Get (Out).

図15に、ゼロマスク生成部600の構成を示す。ゼロマスク生成部600は、(P-swP)を計算する減算器603と、Pビットバレルシフタのシフト方向lrPに基づき、左シフト時にはPビットバレルシフタのシフト量swPを選択し、右シフト時には(P-swP)を選択するセレクタ604と、その選択結果swZに基づきデコードを行うデコーダ605と、デコード結果LZMの各々のビットを反転させる否定回路606から構成される。   FIG. 15 shows the configuration of the zero mask generation unit 600. Based on the subtractor 603 for calculating (P-swP) and the shift direction lrP of the P-bit barrel shifter, the zero mask generation unit 600 selects the shift amount swP of the P-bit barrel shifter when shifting left, and (P-swP) when shifting right ), A decoder 605 that performs decoding based on the selection result swZ, and a negation circuit 606 that inverts each bit of the decoding result LZM.

本実施形態に係るバレルシフト装置は、ゼロマスク制御部304及びAND回路305を備えることにより、2以上のNビットバレルシフタにまたがる左右論理シフトを実行する場合に、シフト結果の上位ビット又は下位ビットに0を挿入可能である。   The barrel shift apparatus according to the present embodiment includes the zero mask control unit 304 and the AND circuit 305, so that when the left-right logical shift across two or more N-bit barrel shifters is executed, 0 is added to the upper bit or the lower bit of the shift result. Can be inserted.

このように、本実施形態に係るバレルシフト装置は、M個のNビットバレルシフタを組み合わせたP(=M×N)ビットバレルシフタを構成する場合に、M個のNビットバレルシフタのシフト結果から、同じビット位置のデータ又はN×R(M>R≧1)ビット離れたビット位置のデータを選択するMto1セレクタを、シフト方向とシフト幅swPとに応じて個別に制御する。M個のNビットバレルシフタの境界で、1〜(N−1)ビット離れた位置のデータを選択するMto1セレクタへの入力は、M個のNビットバレルシフタ時とPビットバレルシフタ時とでは異なるが、M×(N-1)個の2to1セレクタを追加する必要がない。   Thus, when the barrel shift apparatus according to the present embodiment configures a P (= M × N) bit barrel shifter in which M N-bit barrel shifters are combined, the same results are obtained from the shift results of M N-bit barrel shifters. The Mto1 selector that selects bit position data or bit position data separated by N × R (M> R ≧ 1) bits is individually controlled according to the shift direction and the shift width swP. The input to the Mto1 selector that selects data at positions 1 to (N−1) bits apart at the boundary of M N-bit barrel shifters is different for M N-bit barrel shifters and P-bit barrel shifters, There is no need to add M × (N-1) 2to1 selectors.

また、M個のNビットバレルシフタのシフト結果から、同じビット位置のデータ又はN×R(M>R≧1)ビット離れたビット位置のデータを選択するMto1セレクタのセレクト信号を、NビットバレルシフタのNビット左ゼロマスクとNビット右ゼロマスクとNビット左右ゼロマスクセレクタを用いて生成することにより、セレクト信号を生成するハードウェアコストを低減できる。   In addition, from the shift result of M N-bit barrel shifters, the selection signal of the Mto1 selector that selects the data at the same bit position or the data at the bit positions separated by N × R (M> R ≧ 1) bits is sent to The hardware cost for generating the select signal can be reduced by using the N-bit left zero mask, the N-bit right zero mask, and the N-bit left and right zero mask selector.

〔第2の実施形態〕
本発明を好適に実施した第2の実施形態について説明する。図16に、本実施形態に係るPビットバレルシフタの構成を示す。バレルシフタ装置としてのPビットバレルシフタ700は、複数(M)個のNビットバレルシフタ701を組み合わせて、ビット幅のより広いP(=M×N)ビットバレルシフタを低コストに実現するものである。
[Second Embodiment]
A second embodiment in which the present invention is suitably implemented will be described. FIG. 16 shows the configuration of the P-bit barrel shifter according to this embodiment. A P-bit barrel shifter 700 as a barrel shifter device combines a plurality of (M) N-bit barrel shifters 701 to realize a P (= M × N) bit barrel shifter with a wider bit width at a low cost.

ここで、図16に示す構成は、左シフトを基本とする(右シフトは左シフトを応用して実現する)M個のNビットバレルシフタを用いた例であるが、右シフトを基本とする構成であっても良い。   Here, the configuration shown in FIG. 16 is an example using M N-bit barrel shifters based on the left shift (the right shift is realized by applying the left shift), but the configuration based on the right shift. It may be.

本実施形態においては、M個のNビットバレルシフタのゼロマスク制御部を拡張することにより、図2に示した第1の実施形態に係るPビットバレルシフタ装置での論理シフト時のゼロマスク処理を行うためのゼロマスク制御部304とP個のAND回路305とを削減する。   In this embodiment, by extending the zero mask control unit of M N-bit barrel shifters, it is possible to perform zero mask processing at the time of logical shift in the P-bit barrel shifter device according to the first embodiment shown in FIG. The zero mask control unit 304 and the P AND circuits 305 are reduced.

本実施形態に係るバレルシフタ装置の動作原理について、2個の4ビットバレルシフタを組み合わせた8ビットバレルシフタを例に説明する。8ビットバレルシフタと2個の4ビットバレルシフタとのそれぞれにおいて、abcdefghの8ビットデータを0〜7ビットだけ、単純に左・右論理シフトした際のシフト結果と、2個の4ビットバレルシフタを組み合わせたシフト結果(組み合わせ結果)を図17及び図18に示す。   The operation principle of the barrel shifter device according to this embodiment will be described by taking an 8-bit barrel shifter in which two 4-bit barrel shifters are combined as an example. In each of the 8-bit barrel shifter and the two 4-bit barrel shifters, the shift result when the abcdefgh 8-bit data is simply left / right logically shifted by 0 to 7 bits and the two 4-bit barrel shifters are combined. The shift results (combination results) are shown in FIGS.

図17と図18から分かるように、各4ビットバレルシフタで、単純に左・右論理シフトし組み合わせただけでは、8ビットバレルシフタでの左・右論理シフトの結果と一致しない。2個の4ビットバレルシフタを組み合わせた8ビットバレルシフタの結果と、8ビットバレルシフタでの左・右論理シフトの結果を一致させるには、2個の4ビットバレルシフタの左・右論理シフト結果が図19、図20となるように制御する必要がある。また、図19及び図20には、その際に4ビットバレルシフタが利用するゼロマスクも併記する。   As can be seen from FIG. 17 and FIG. 18, the left and right logical shifts in the 8-bit barrel shifter do not coincide with each 4-bit barrel shifter simply by combining the left and right logical shifts. To match the result of the 8-bit barrel shifter combining two 4-bit barrel shifters with the result of the left / right logical shift in the 8-bit barrel shifter, the left / right logical shift results of the two 4-bit barrel shifters are shown in FIG. It is necessary to perform control so as to be as shown in FIG. 19 and 20 also show a zero mask used by the 4-bit barrel shifter at that time.

左論理シフト時の図19では、シフト量が3(011)以下の場合には、左側の4ビットバレルシフタのみ左論理シフトを行い、右側の4ビットバレルシフタは左ローテートを行うように制御することにより、8ビットバレルシフタと組み合わせ結果の左論理シフト結果とが一致する。また、シフト量が4(100)以上の場合には、左側の4ビットバレルシフタの結果の全ビットが0となるように制御し、右側の4ビットバレルシフタは左論理シフトを行うように制御することにより、8ビットバレルシフタと組み合わせ結果の左論理シフト結果とが一致する。   In FIG. 19 at the time of left logical shift, when the shift amount is 3 (011) or less, only the left 4-bit barrel shifter performs left logical shift, and the right 4-bit barrel shifter performs control to perform left rotation. The 8-bit barrel shifter matches the left logical shift result of the combination result. When the shift amount is 4 (100) or more, control is performed so that all the bits of the result of the left 4-bit barrel shifter are 0, and the right 4-bit barrel shifter is controlled to perform the left logical shift. Thus, the 8-bit barrel shifter matches the left logical shift result of the combination result.

右論理シフト時の図20では、シフト量が3(011)以下の場合には、右側の4ビットバレルシフタのみ右論理シフトを行い、左側の4ビットバレルシフタは右ローテートを行うように制御することにより、8ビットバレルシフタと組み合わせ結果の右論理シフト結果とが一致する。また、シフト量が4(100)以上の場合には、右側の4ビットバレルシフタの結果の全ビットが0となるように制御し、左側の4ビットバレルシフタは右論理シフトを行うように制御することにより、8ビットバレルシフタと組み合わせ結果の右論理シフト結果とが一致する。   In FIG. 20 at the time of right logical shift, when the shift amount is 3 (011) or less, only the right 4-bit barrel shifter performs right logical shift, and the left 4-bit barrel shifter performs control to perform right rotation. The 8-bit barrel shifter matches the right logical shift result of the combination result. When the shift amount is 4 (100) or more, control is performed so that all bits of the result of the right 4-bit barrel shifter become 0, and the left 4-bit barrel shifter is controlled to perform the right logical shift. Thus, the 8-bit barrel shifter matches the right logical shift result of the combination result.

以下の説明においては、図17〜図20で説明した基本動作原理に基づき、一般化した図16のPビットバレルシフタ700について説明する。   In the following description, the generalized P-bit barrel shifter 700 of FIG. 16 will be described based on the basic operation principle described with reference to FIGS.

図16に示すように、Pビットバレルシフタ700は、M個のN(2のべき乗)ビットバレルシフタ701に、P(=M×N)個のMto1セレクタ702と、Pビットバレルシフタのシフト方向(lrP)とシフト量swPとから、P個のMto1セレクタ702のセレクト信号を生成するシフト量制御部703と、Nビットバレルシフタ701のゼロマスク制御部を拡張し、その制御をすることにより、Pビットバレルシフタでの論理シフトを実現するゼロマスク拡張部704とから構成される。なお、Nビットバレルシフタ701は図1のNビットバレルシフタ1に相当する。また、P個のMto1セレクタ702は図1のMto1セレクタ2に相当する。さらに、シフト量制御部703は図1のシフト量制御部3に相当する。   As shown in FIG. 16, the P-bit barrel shifter 700 includes an M number of N (powers of 2) bit barrel shifters 701, a P (= M × N) number of Mto1 selectors 702, and a P bit barrel shifter shift direction (lrP). And the shift amount control unit 703 that generates the select signals of the P Mto1 selectors 702 from the shift amount swP and the zero mask control unit of the N-bit barrel shifter 701 are expanded and controlled so that the P-bit barrel shifter And a zero mask extension unit 704 that realizes a logical shift. The N-bit barrel shifter 701 corresponds to the N-bit barrel shifter 1 in FIG. The P Mto1 selectors 702 correspond to the Mto1 selector 2 in FIG. Further, the shift amount control unit 703 corresponds to the shift amount control unit 3 in FIG.

Nビットバレルシフタ701のゼロマスク制御部を拡張し、Pビットバレルシフタ700での論理シフトを実行させるため、拡張したNビットバレルシフタ701のゼロマスク制御部を図21に示す。   FIG. 21 shows an expanded zero mask control unit of the N-bit barrel shifter 701 in order to expand the zero mask control unit of the N-bit barrel shifter 701 and execute a logical shift in the P-bit barrel shifter 700.

図21に示すゼロマスク制御部800は、図4に示したNビットバレルシフタのゼロマスク制御部3012に、セレクタ群が追加されている。これらの追加されたセレクタ群の制御信号であるsel_lr、sel_sw、sel_lzm、sel_rotは、図14に示すゼロマスク拡張部704により、Pビットバレルシフタのローテートフラグ(rotP)、シフト方向(lrP)、シフト量(swP)から生成する。   In the zero mask control unit 800 shown in FIG. 21, a selector group is added to the zero mask control unit 3012 of the N-bit barrel shifter shown in FIG. These added selector group control signals sel_lr, sel_sw, sel_lzm, and sel_rot are converted to a P-bit barrel shifter rotation flag (rotP), shift direction (lrP), shift amount (zero) by the zero mask extension unit 704 shown in FIG. Generate from swP).

まず、図21に示したM個のNビットバレルシフタのゼロマスク制御部800の構成について説明する。   First, the configuration of the zero mask control unit 800 of the M N-bit barrel shifters shown in FIG. 21 will be described.

図19、図20のゼロマスクが示すように、論理シフトを実行した際の、M個のNビットバレルシフタのシフト結果と、Pビットバレルシフトの結果とを一致させるには、シフト方向とシフト量とに応じて、各Nビットバレルシフタのゼロマスク制御部800が生成するゼロマスク(ZM)を、全ビット1(ONE)、全ビット0(ZERO)、左ゼロマスク(LZM)、右ゼロマスク(RZM)のいずれかに指定する構成が必要となる。   As shown by the zero masks in FIGS. 19 and 20, in order to make the shift result of the M N-bit barrel shifters and the result of the P-bit barrel shift coincide with each other when the logical shift is executed, The zero mask (ZM) generated by the zero mask control unit 800 of each N-bit barrel shifter is selected from among all bits 1 (ONE), all bits 0 (ZERO), left zero mask (LZM), and right zero mask (RZM). The configuration specified in is required.

まず、ゼロマスク(ZM)を全ビット1(ONE)とするために、ローテート時にゼロマスク(ZM)を全ビット1(ONE)に指定するためのセレクタ801の制御信号を、ローテート制御信号(sel_rot)に基づいて生成するセレクタ802を追加し、sel_rotが1である場合には、全ビット1(ONE)がゼロマスク(ZM)となるようにする。これにより、Pビットバレルシフタが論理シフトを実行している際に、rotが0となっていても、全ビット1(ONE)がゼロマスク(ZM)として選択できるようになる。   First, in order to set the zero mask (ZM) to all bits 1 (ONE), the control signal of the selector 801 for designating the zero mask (ZM) to all bits 1 (ONE) during rotation is set to the rotate control signal (sel_rot). A selector 802 to be generated based on this is added, and when sel_rot is 1, all bits 1 (ONE) are set to zero mask (ZM). As a result, when the P-bit barrel shifter performs a logical shift, even if rot is 0, all bits 1 (ONE) can be selected as a zero mask (ZM).

次に、ゼロマスク(ZM)を全ビット0(ZERO)とするために、ゼロマスク生成部803が生成する左ゼロマスク(LZM)が、11・・・000となるように、シフト方向制御信号(sel_Lr)に基づき、ゼロマスク生成部803に入力するシフト方向を左(1)に設定するセレクタ804と、シフト量制御信号(sel_sw)に基づき、ゼロマスク生成部803に入力するシフト量をONE(11・・・111)に設定するセレクタ805と、左ゼロマスク制御信号(sel_lzm)に基づき、ゼロマスク生成部803が生成した左ゼロマスク(11・・・000)の最上位ビットのみ、0を選択するようにするセレクタ806と、セレクタ806の選択結果と右ゼロマスクを選択するセレクタ807の制御信号を、シフト方向制御信号(sel_lr)に基づき、セレクタ806の選択結果を選択するためのセレクタ808を追加する。   Next, in order to set the zero mask (ZM) to all bits 0 (ZERO), the shift direction control signal (sel_Lr) is set so that the left zero mask (LZM) generated by the zero mask generation unit 803 is 11. Based on the selector 804 that sets the shift direction to be input to the zero mask generation unit 803 to the left (1) and the shift amount input to the zero mask generation unit 803 based on the shift amount control signal (sel_sw). 111) and a selector 806 that selects 0 only for the most significant bit of the left zero mask (11... 000) generated by the zero mask generation unit 803 based on the left zero mask control signal (sel_lzm). The selection result of the selector 806 and the control signal of the selector 807 that selects the right zero mask are selected based on the shift direction control signal (sel_lr). To add a selector 808 for.

最後に、ゼロマスク(ZM)を左ゼロマスク(LZM)、又は右ゼロマスク(RZM)とするためには、シフト方向制御信号(sel_lr)を0、シフト量制御信号(sel_sw)を0、ローテート制御信号(sel_rot)を0、左ゼロマスク制御信号(sel_lzm)を0とすることにより実現する。   Finally, in order to set the zero mask (ZM) to the left zero mask (LZM) or the right zero mask (RZM), the shift direction control signal (sel_lr) is 0, the shift amount control signal (sel_sw) is 0, and the rotate control signal ( This is realized by setting sel_rot) to 0 and the left zero mask control signal (sel_lzm) to 0.

また、図21では、全ビット0(ZERO)とするために、左ゼロマスク(LZM)を拡張した構成をとっているが、右ゼロマスク(RZM)を拡張した構成をとっても構わない。   In FIG. 21, the left zero mask (LZM) is extended to set all bits to 0 (ZERO). However, the right zero mask (RZM) may be extended.

以下では、Pビットバレルシフタのローテートフラグ(rotP)、シフト量(swP)から、図21の各種制御信号(sel_lr、sel_sw、sel_lzm、sel_rzm、sel_rot)を生成する図16のゼロマスク拡張部704について、その詳細を説明する。   In the following, the zero mask extension 704 in FIG. 16 that generates various control signals (sel_lr, sel_sw, sel_lzm, sel_rzm, sel_rot) in FIG. 21 from the rotation flag (rotP) and shift amount (swP) of the P-bit barrel shifter will be described. Details will be described.

まず、ゼロマスク拡張部704の構成方法について、4個の4ビットバレルシフタを組み合わせた16ビットバレルシフタを例に説明する。a〜pからなる16ビットデータを、0〜16ビット左論理シフトしたシフト結果と、その際の各4ビットバレルシフタが利用するゼロマスクを図22に示す。   First, a configuration method of the zero mask extension unit 704 will be described using a 16-bit barrel shifter in which four 4-bit barrel shifters are combined as an example. FIG. 22 shows a shift result obtained by logically shifting the 16-bit data consisting of a to p by 0 to 16 bits to the left and the zero mask used by each 4-bit barrel shifter at that time.

図22に示すゼロマスクを参照すると、縦線部が全ビット1(ONE)、網掛け部が全ビット0(ZERO)となっており、他の部分は、通常の左論理シフト時に生成される左ゼロマスク(LZM)となっている。   Referring to the zero mask shown in FIG. 22, the vertical line portion is all bits 1 (ONE), the shaded portion is all bits 0 (ZERO), and the other portions are left generated during normal left logical shift. It is a zero mask (LZM).

図22の下位3番目(一番左側)の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が00の場合に左ゼロマスク(LZM)を選択し、sw[3:2]が01以上の場合には全ビット0(ZERO)を選択する。   Focusing on the zero mask of the lower third (leftmost) 4-bit barrel shifter in Fig. 22, the left zero mask (LZM) is selected when the lower third and second bits of the shift amount (sw [3: 2]) are 00 If sw [3: 2] is equal to or greater than 01, all bits 0 (ZERO) are selected.

図22の下位2番目の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が00の場合に全ビット1(ONE)を選択し、sw[3:2]が01の場合には左ゼロマスク(LZM)を選択し、sw[3:2]が10以上の場合には全ビット0(ZERO)を選択する。   Focusing on the zero mask of the lower second 4-bit barrel shifter in FIG. 22, when the lower third and second bits (sw [3: 2]) of the shift amount are 00, all bits 1 (ONE) are selected and sw [ When 3: 2] is 01, the left zero mask (LZM) is selected, and when sw [3: 2] is 10 or more, all bits 0 (ZERO) are selected.

図22の下位1番目の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が01以下の場合に全ビット1(ONE)を選択し、sw[3:2]が10の場合には左ゼロマスク(LZM)を選択し、SW[3:2]が11の場合には全ビット0(ZERO)を選択する。   Focusing on the zero mask of the lower first 4-bit barrel shifter in FIG. 22, when the lower third and second bits (sw [3: 2]) of the shift amount are 01 or less, all bits 1 (ONE) are selected and sw When [3: 2] is 10, the left zero mask (LZM) is selected, and when SW [3: 2] is 11, all bits 0 (ZERO) are selected.

図22の下位0番目(一番右側)の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])10以下の場合に全ビット1(ONE)を選択し、sw[3:2]が11の場合には左ゼロマスク(LZM)を選択する。   Looking at the zero mask of the lower 0th (rightmost) 4-bit barrel shifter in FIG. 22, when the lower 3rd and 2nd bits (sw [3: 2]) of the shift amount are 10 or less, all bits 1 (ONE) are set. If sw [3: 2] is 11, the left zero mask (LZM) is selected.

以上をまとめると、下位B(M>B≧0)番目の4ビットバレルシフタのゼロマスクは、シフト量の下位3〜2ビット目とBとの大小関係に基づき、全ビット1(ONE)、全ビット0(ZERO)、左ゼロマスク(LZM)を選択していることが分かる。   To summarize the above, the zero mask of the lower B (M> B ≧ 0) 4-bit barrel shifter is based on the magnitude relationship between the lower third and second bits of the shift amount and B, all bits 1 (ONE), all bits It can be seen that 0 (ZERO) and the left zero mask (LZM) are selected.

一般化すると、swP(P>swP≧0)ビット左論理シフトを実行する際に、下位B(M>B≧0)番目のNビットバレルシフタのゼロマスクが(N×(M-B-1))>swPである場合には全ビット1(ONE)となるようにバレルシフタのゼロマスク制御部800へのローテート制御信号(sel_rot)を1とし、(N×(M-B))>swP≧(N×(M-B-1))である場合には左ゼロマスク(LZM)となるようにバレルシフタのゼロマスク制御部800へのローテート制御信号(sel_rot)を0とし、シフト制御信号(sel_sw)を0とし、シフト量制御方向制御信号(sel_lr)を0とし、左シフト制御信号(sel_lzm)を0とし、swP≧(N×(M-B))である場合には、全ビット0(ZERO)となるようにバレルシフタのゼロマスク制御部800へのローテート制御信号(sel_rot)を0とし、シフト量制御信号(sel_sw)を1とし、シフト方向制御信号(sel_lr)を1とし、左シフト制御信号(sel_lzm)を1とするようにゼロマスク制御部704を構成する。   In general, when performing swP (P> swP ≧ 0) bit left logical shift, the zero mask of the lower B (M> B ≧ 0) th N-bit barrel shifter is (N × (MB−1))> swP , The rotation control signal (sel_rot) to the barrel shifter zero mask controller 800 is set to 1 so that all bits are 1 (ONE), and (N × (MB))> swP ≧ (N × (MB-1 )), The rotation control signal (sel_rot) to the zero shift control unit 800 of the barrel shifter is set to 0, the shift control signal (sel_sw) is set to 0, and the shift amount control direction control signal is set so that the left zero mask (LZM) is obtained. When (sel_lr) is set to 0, the left shift control signal (sel_lzm) is set to 0, and swP ≧ (N × (MB)), the zero shift control unit 800 of the barrel shifter is set so that all bits are 0 (ZERO). Rotation control signal (sel_rot) is set to 0, shift amount control signal (sel_sw) is set to 1, and shift direction control signal (sel_lr) is set to 1. Left shift control signal (sel_lzm) to the 1 constitutes a zero mask control unit 704.

上記機能を実現する回路の構成を図23に示す。図示するのは、M個のNビットバレルシフタのうちの下位B(M>B≧0)番目のNビットバレルシフタのゼロマスク制御部800を制御する回路であり、ゼロマスク拡張部704は、M個のNビットバレルシフタのゼロマスク制御部を制御するため、図23の回路をMセット持つ構成となる。   FIG. 23 shows a circuit configuration for realizing the above function. Shown is a circuit for controlling the zero mask control unit 800 of the lower B (M> B ≧ 0) th N-bit barrel shifter among the M N-bit barrel shifters, and the zero mask extension unit 704 includes M N-bit barrel shifters. In order to control the zero mask control unit of the bit barrel shifter, the circuit of FIG.

図23に示すように、シフト量(swP)と、(N×(M-B-1))又は(N×(M-B))との大小関係(大又は等しい:0、小:1)を比較するための減算器900、901と、Pビットバレルシフタのローテートフラグ(rotP)に基づき、f0又は1をローテート制御信号(sel_rot)として選択するセレクタ902と、大小関係(f0、f1)の否定の論理積を計算するAND回路903とにより、1セットの回路を構成する。
ここで、(N×(M-B-1))又は(N×(M-B))は各Nビットバレルシフタのゼロマスク制御部ごとに定数となるため、ゼロマスク拡張部704でオンラインに計算する(シフト実行時に逐一計算する)必要はない。
As shown in FIG. 23, to compare the magnitude relationship (large or equal: 0, small: 1) between the shift amount (swP) and (N × (MB-1)) or (N × (MB)). Subtracters 900 and 901, a selector 902 that selects f0 or 1 as a rotation control signal (sel_rot) based on the rotation flag (rotP) of the P-bit barrel shifter, and a negative logical product of magnitude relations (f0, f1) The AND circuit 903 to be calculated constitutes a set of circuits.
Here, since (N × (MB-1)) or (N × (MB)) is a constant for each zero mask control unit of each N-bit barrel shifter, it is calculated online by the zero mask extension unit 704 (one by one at the time of shift execution). No need to calculate).

次に、ゼロマスク拡張部704の構成方法について、4個の4ビットバレルシフタを組み合わせた16ビットバレルシフタにおいて、a〜pからなる16ビットデータを0〜16ビット右論理シフトする場合を例に説明する。右論理シフトしたシフト結果とその際の各4ビットバレルシフタが利用するゼロマスクとを図24に示す。   Next, a configuration method of the zero mask extension unit 704 will be described by taking as an example a case where 16-bit data composed of a to p is logically shifted by 0 to 16 bits to the right in a 16-bit barrel shifter in which four 4-bit barrel shifters are combined. FIG. 24 shows the result of the right logical shift and the zero mask used by each 4-bit barrel shifter at that time.

図24に示すゼロマスクを参照すると、縦線部が全ビット1(ONE)、網掛け部が0(ZERO)になっており、他の部分は通常の右論理シフト時に生成される右ゼロマスク(RZM)となっている。   Referring to the zero mask shown in FIG. 24, the vertical line part is all bits 1 (ONE) and the shaded part is 0 (ZERO), and the other part is a right zero mask (RZM generated during normal right logical shift). ).

図24の下位3番目(一番左側)の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が11の場合に右ゼロマスクを選択し、sw[3:2]が10以下の場合には全ビット1(ONE)を選択する。   Focusing on the zero mask of the lower third (leftmost) 4-bit barrel shifter in FIG. 24, when the lower third and second bits (sw [3: 2]) of the shift amount are 11, the right zero mask is selected and sw When [3: 2] is 10 or less, all bits 1 (ONE) are selected.

図24の下位2番目の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が01以下の場合に全ビット1(ONE)を選択し、sw[3:2]が10の場合には右ゼロマスク(RZM)を選択し、sw[3:2]が11の場合には全ビット0(ZERO)を選択する。   Paying attention to the zero mask of the lower second 4-bit barrel shifter in FIG. 24, when the lower third and second bits (sw [3: 2]) of the shift amount are 01 or less, all bits 1 (ONE) are selected and sw When [3: 2] is 10, the right zero mask (RZM) is selected, and when sw [3: 2] is 11, all bits 0 (ZERO) are selected.

図24の下位1番目の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が00の場合に全ビット1(ONE)を選択し、sw[3:2]が01の場合には右ゼロマスク(RZM)を選択し、sw[3:2]が10以上の場合には全ビット0(ZERO)を選択する。   Focusing on the zero mask of the lower first 4-bit barrel shifter in FIG. 24, when the lower third and second bits (sw [3: 2]) of the shift amount are 00, all bits 1 (ONE) are selected and sw [ When 3: 2] is 01, the right zero mask (RZM) is selected, and when sw [3: 2] is 10 or more, all bits 0 (ZERO) are selected.

図24の下位0番目(一番右側)の4ビットバレルシフタのゼロマスクに着目すると、シフト量の下位3〜2ビット目(sw[3:2])が00の場合に右ゼロマスク(RZM)を選択し、sw[3:2]が01以上の場合には全ビット0(ZERO)を選択する。   Focusing on the zero mask of the lower 0th (rightmost) 4-bit barrel shifter in Fig. 24, if the lower 3rd and 2nd bits (sw [3: 2]) of the shift amount are 00, the right zero mask (RZM) is selected. If sw [3: 2] is equal to or greater than 01, all bits 0 (ZERO) are selected.

以上をまとめると、下位B(M>B≧0)番目の4ビットバレルシフタのゼロマスクは、シフト量の下位3〜2ビット目とBとの大小関係に基づき、全ビット1(ONE)、全ビット0(ZERO)、右ゼロマスク(RZM)を選択していることが分かる。
一般化すると、swP(P>swP≧0)ビット右論理シフトを実行する際に、下位B(M>B≧0)番目のNビットバレルシフタのゼロマスタが(N×B)>swPである場合には全ビット1(ONE)となるようにバレルシフタのゼロマスク制御部800へのローテート制御信号(sel_rot)を1とし、(N×(B+1))>swP≧(N×B)である場合には右ゼロマスク(RZM)となるようにバレルシフタのゼロマスク制御部800へのローテート制御信号(sel_rot)を0とし、シフト量制御信号(sel_sw)を0とし、シフト方向制御信号(sel_lr)を0とし、左シフト制御信号(sel_lzm)を0とし、swP≧(N×(B-1))である場合には全ビット0(ZERO)となるようにバレルシフタのゼロマスタ制御部800へのローテート制御信号(sel_rot)を0とし、シフト量制御信号(sel_sw)を1とし、シフト方向制御信号(sel_lr)を1とし、左シフト制御信号(sel_lzm)と1とするように、ゼロマスク制御部704を構成すればよい。
To summarize the above, the zero mask of the lower B (M> B ≧ 0) 4-bit barrel shifter is based on the magnitude relationship between the lower third and second bits of the shift amount and B, all bits 1 (ONE), all bits It can be seen that 0 (ZERO) and right zero mask (RZM) are selected.
In general, when swP (P> swP ≧ 0) bit right logical shift is performed, if the zero master of the lower B (M> B ≧ 0) th N-bit barrel shifter is (N × B)> swP Is set so that the rotation control signal (sel_rot) to the zero mask controller 800 of the barrel shifter is 1 so that all bits are 1 (ONE), and (N × (B + 1))> swP ≧ (N × B). Rotate control signal (sel_rot) to zero mask control unit 800 of the barrel shifter is set to 0, shift amount control signal (sel_sw) is set to 0, shift direction control signal (sel_lr) is set to 0 so that the right zero mask (RZM) is obtained. When the left shift control signal (sel_lzm) is 0 and swP ≧ (N × (B-1)), the rotation control signal (sel_rot to the zero master control unit 800 of the barrel shifter is set so that all bits are 0 (ZERO). ) To 0, shift amount control signal (sel_sw) to 1, shift direction control signal (sel_lr) to 1, left shift control signal (Sel_lzm) and to the 1, it may be configured to zero mask control unit 704.

上記機能を実現する回路の構成を図25に示す。図25に示すのは、M個のNビットバレルシフタのうちの下位B(M>B≧0)番目のNビットバレルシフタのゼロマスク制御部800を制御する回路であり、図23で示した左論理シフト用の制御回路を右論理シフトにも利用できるように拡張している。なお、ゼロマスク拡張部704は、M個のNビットバレルシフタのゼロマスク制御部を制御するため、図25の回路をMセット持つ構成となる。   FIG. 25 shows a circuit configuration for realizing the above function. FIG. 25 shows a circuit for controlling the zero mask controller 800 of the lower B (M> B ≧ 0) -th N-bit barrel shifter among the M N-bit barrel shifters, and the left logical shift shown in FIG. The control circuit is expanded so that it can also be used for the right logic shift. Note that the zero mask extension unit 704 is configured to have M sets of the circuit of FIG. 25 in order to control the zero mask control units of M N-bit barrel shifters.

以上のように、Nビットバレルシフタのゼロマスク制御部を図21のように拡張し、ゼロマスク制御部を制御する図25に示すようなゼロマスク拡張部704を用いることにより、図2に示したPビットバレルシフタでの論理シフト時のゼロマスク処理を行うためのゼロマスク制御部304及びP個のAND回路305とを削減できる。   As described above, the zero bit control unit of the N-bit barrel shifter is expanded as shown in FIG. 21, and the zero mask extension unit 704 as shown in FIG. 25 for controlling the zero mask control unit is used, so that the P bit barrel shifter shown in FIG. Thus, the zero mask control unit 304 and the P AND circuits 305 for performing the zero mask process at the time of logical shift in FIG.

一方で、図16におけるシフト量制御部703は、図2におけるシフト量制御部303と同様に、M個のNビットバレルシフタのゼロマスク制御部の一つを図12のように拡張し、ゼロマスク制御部が生成したゼロマスク(ZM)を用いて図16におけるP個のMto1セレクタ702の制御信号の0ビット目として利用している。   On the other hand, like the shift amount control unit 303 in FIG. 2, the shift amount control unit 703 in FIG. 16 extends one of the zero mask control units of the M N-bit barrel shifters as shown in FIG. Is used as the 0th bit of the control signals of the P Mto1 selectors 702 in FIG.

また、図13に示すように、ゼロマスク制御部が生成した右ゼロマスク(RZM)と左ゼロマスク(LZM)とを用いて、図16におけるP個のMto1セレクタ702の制御信号の(H-1)〜1ビット目の生成に利用している。ここで、H=[log2M]とする。   Further, as shown in FIG. 13, by using the right zero mask (RZM) and the left zero mask (LZM) generated by the zero mask control unit, the control signals (H−1) ˜ of the control signals of the P Mto1 selectors 702 in FIG. This is used to generate the first bit. Here, H = [log2M].

このため、Nビットバレルシフタのゼロマスク制御部の拡張による、Pビットバレルシフタでの論理シフト時のゼロマスク処理と、Nビットバレルシフタのゼロマスク制御部の一つを用いたP個のMto1セレクタの制御信号の生成は、ともにNビットバレルシフタのゼロマスク制御部の出力であるゼロマスク(ZM)と、左右ゼロマスク(LZM、RZM)を利用するため、単純に組み合わせて実装することはできない。   For this reason, the zero mask processing at the time of logic shift in the P bit barrel shifter by the extension of the zero mask control unit of the N bit barrel shifter and the generation of control signals for the P Mto1 selectors using one of the zero mask control units of the N bit barrel shifter Both use the zero mask (ZM) output from the zero mask control unit of the N-bit barrel shifter and the left and right zero masks (LZM, RZM), and therefore cannot be implemented simply in combination.

そこで、図22、図24に示す左・右論理シフト時に利用するゼロマスクの発生パターンに着目し、図21のゼロマスク制御部800を以下のように拡張する。   Accordingly, paying attention to the generation pattern of the zero mask used at the time of the left / right logical shift shown in FIGS. 22 and 24, the zero mask control unit 800 of FIG. 21 is expanded as follows.

左論理シフトする際に、図22における下位3〜1番目の4ビットバレルシフタは、シフト量によっては、全ビット0(ZERO)を論理シフトのゼロマスク(ZM)として選択する場合がある。一方、下位0番目の4ビットバレルシフタは、全ビット0(ZERO)を論理シフトのゼロマスク(ZM)として選択することがない。   When the left logical shift is performed, the lower 3rd to 1st 4-bit barrel shifter in FIG. 22 may select all bits 0 (ZERO) as a logical shift zero mask (ZM) depending on the shift amount. On the other hand, the lower 0th 4-bit barrel shifter does not select all bits 0 (ZERO) as a zero mask (ZM) for logical shift.

また、下位0番目の4ビットバレルシフタは、シフト量に応じて左ゼロマスク(LZM)又は全ビット1(ONE)をゼロマスク(ZM)として選択するが、全ビット1(ONE)の選択は、図21のセレクタ801で行われるため、シフト量に関わらずセレクタ807の出力が左ゼロマスク(LZM)となるように、sel_sw、sel_lzm、sel_lrを0としても構わない。   The lower 0th 4-bit barrel shifter selects the left zero mask (LZM) or all bits 1 (ONE) as the zero mask (ZM) according to the shift amount. The selection of all bits 1 (ONE) is shown in FIG. Therefore, sel_sw, sel_lzm, and sel_lr may be set to 0 so that the output of the selector 807 becomes a left zero mask (LZM) regardless of the shift amount.

そうすることにより、左論理シフト時において、シフト量に関わらず、下位0番目の4ビットバレルシフタの図21のゼロマスク生成部803から、シフト量制御部703が所望する左右ゼロマスク(LZM、RZM)を得ることができる。さらには、シフト量に関わらず、図21のセレクタ807から、シフト量制御部703が所望する左右ゼロマスク(LZM、RZM)の選択結果を得ることができる。   By doing so, the left and right zero masks (LZM, RZM) desired by the shift amount control unit 703 are obtained from the zero mask generation unit 803 of FIG. 21 of the lower 0th 4-bit barrel shifter at the time of the left logical shift. Obtainable. Further, regardless of the shift amount, the left / right zero mask (LZM, RZM) selection result desired by the shift amount control unit 703 can be obtained from the selector 807 in FIG.

これを実現するため、M個のNバレルシフタのうちの下位0番目のゼロマスク制御部を、図26に示すように拡張する。図26に示すように、シフト量制御部703が所望するゼロマスクを生成するために、セレクタ1100と否定的排他論理和1101とを図21に示したゼロマスク制御部に追加する。また、シフト量に関わらず、シフト量制御部703が所望する左右ゼロマスク(LZM、RZM)の選択結果を得るため、図26のセレクタ1102の出力(SWZM)を取り出し、シフト量制御部703において図16におけるP個のMto1セレクタ702の制御信号の0ビット目の生成に利用する。
ゼロマスク制御部に追加する。
In order to realize this, the lower zeroth zero mask control unit of the M N barrel shifters is expanded as shown in FIG. As shown in FIG. 26, the selector 1100 and the negative exclusive OR 1101 are added to the zero mask controller shown in FIG. 21 in order to generate a desired zero mask by the shift amount controller 703. In addition, in order to obtain the desired left and right zero mask (LZM, RZM) selection result regardless of the shift amount, the output (SWZM) of the selector 1102 in FIG. 16 is used to generate the 0th bit of the control signal of the P Mto1 selectors 702 in FIG.
Add to the zero mask controller.

また、下位0番目のゼロマスク制御部のゼロマスク生成部803が生成する左右ゼロマスク(LZM,RZM)を、図16におけるP個のMto1セレクタ702の制御信号の(H-1)〜1ビット目の生成に利用している。ここで、H=[log2M]とする。   Further, the left and right zero masks (LZM, RZM) generated by the zero mask generation unit 803 of the lower zeroth zero mask control unit are generated from the (H-1) to the first bit of the control signals of the P Mto1 selectors 702 in FIG. It is used for. Here, H = [log2M].

右論理シフトする際に、図24における下位2〜0番目の4ビットバレルシフタは、シフト量によっては、全ビット0(ZERO)を論理シフトのゼロマスク(ZM)として選択する場合がある。一方、下位3番目の4ビットバレルシフタは、全ビット0(ZERO)を論理シフトのゼロマスク(ZM)として選択することがない。   When performing the right logical shift, the lower 2 to 0th 4-bit barrel shifter in FIG. 24 may select all bits 0 (ZERO) as a logical shift zero mask (ZM) depending on the shift amount. On the other hand, the lower third 4-bit barrel shifter does not select all bits 0 (ZERO) as a zero mask (ZM) for logical shift.

また、下位3番目の4ビットバレルシフタは、シフト量に応じて、右ゼロマスク(RZM)又は全ビット1(ONE)をゼロマスク(ZM)として選択するが、全ビット1(ONE)の選択は、図18のセレクタ801で行われるため、シフト量に関わらずセレクタ807の出力を右ゼロマスク(RZM)となるように、sel_sw、sel_lzm、sel_lrを0としても構わない。   The lower third 4-bit barrel shifter selects the right zero mask (RZM) or all bits 1 (ONE) as the zero mask (ZM) according to the shift amount. Therefore, sel_sw, sel_lzm, and sel_lr may be set to 0 so that the output of the selector 807 becomes a right zero mask (RZM) regardless of the shift amount.

そうすることにより、右論理シフト時において、シフト量に関わらず、下位0番目の4ビットバレルシフタの図21のゼロマスク生成部803からシフト量制御部703が所望する左右ゼロマスク(LZM、RZM)を得ることができる。さらには、シフト量に関わらず、図21のセレクタ807からシフト量制御部703が所望する左右ゼロマスク(LZM、RZM)の選択結果を得ることができる。   By doing so, the right and left zero masks (LZM, RZM) desired by the shift amount control unit 703 are obtained from the zero mask generation unit 803 of FIG. 21 of the lower 0th 4-bit barrel shifter at the time of the right logical shift. be able to. Furthermore, regardless of the shift amount, the selection result of the left and right zero masks (LZM, RZM) desired by the shift amount control unit 703 can be obtained from the selector 807 in FIG.

上記を実現するため、M個のNビットバレルシフタのうちの下位(M-1)番目のゼロマスク制御部を、図26に示すように拡張する。図26に示すように、シフト量制御部703が所望するゼロマスクを生成するために、セレクタ1100と否定的排他論理和1101とを、図21に示したゼロマスク制御部に追加する。また、シフト量に関わらず、シフト量制御部703が所望する左右ゼロマスク(LZM、RZM)の選択結果を得るため、図26のセレクタ1102の出力(SWZM)を取り出し、シフト量制御部703において図16におけるP個のMto1セレクタ702の制御信号の0ビット目の生成に利用する。   In order to realize the above, the lower (M−1) th zero mask control unit of the M N-bit barrel shifters is expanded as shown in FIG. As shown in FIG. 26, in order to generate a desired zero mask by the shift amount control unit 703, a selector 1100 and a negative exclusive OR 1101 are added to the zero mask control unit shown in FIG. In addition, in order to obtain the desired left and right zero mask (LZM, RZM) selection result regardless of the shift amount, the output (SWZM) of the selector 1102 in FIG. 16 is used to generate the 0th bit of the control signal of the P Mto1 selectors 702 in FIG.

また、下位(M-1)番目のゼロマスク制御部のゼロマスク生成部803が生成する左右ゼロマスク(LZM、RZM)を、図16におけるP個のMto1セレクタ702の制御信号(H-1)〜1ビット目の生成に利用している。ここで、H=[log2M]とする。   Further, the left and right zero masks (LZM, RZM) generated by the zero mask generation unit 803 of the lower (M-1) th zero mask control unit are used as control signals (H-1) to 1 bit of the P Mto1 selectors 702 in FIG. It is used for eye generation. Here, H = [log2M].

このように、左論理シフトする場合と右論理シフトする場合とでは、図16のP個のMto1セレクタ702の制御信号を生成するシフト量制御部703で利用可能なゼロマスク(ZM)と左右ゼロマスク(LZM、RZM)を生成するNビットバレルシフタが異なる。左論理シフト時には下位0番目のNビットバレルシフタ、右論理シフト時には下位(M-1)番目のNビットバレルシフタである。   As described above, in the case of the left logical shift and the right logical shift, the zero mask (ZM) and the left and right zero masks (which can be used by the shift amount control unit 703 that generates the control signals of the P Mto1 selectors 702 in FIG. The N-bit barrel shifter that generates (LZM, RZM) is different. The lower 0th N-bit barrel shifter at the left logical shift, and the lower (M-1) th N-bit barrel shifter at the right logical shift.

このため、Pビットバレルシフタのシフト方向(lrP)に応じて、下位(M-1)番目のNビットバレルシフタのゼロマスク制御部が生成するシフトゼロマスク(SWZM)、左右ゼロマスク(LZM、RZM)とを選択するセレクタを、ゼロマスク制御部703に追加する。これにより、論理シフト時であっても、シフト量制御部に所望のシフトゼロマスク(SWZM)を提供できる。   Therefore, the shift zero mask (SWZM) and the left and right zero masks (LZM, RZM) generated by the zero mask control unit of the lower (M-1) th N bit barrel shifter are selected according to the shift direction (lrP) of the P bit barrel shifter. A selector to be added is added to the zero mask control unit 703. Thereby, even during the logical shift, a desired shift zero mask (SWZM) can be provided to the shift amount control unit.

このように、M個のNビットバレルシフタの論理シフト用のNビットゼロマスクを生成するゼロマスク制御部に、Pビットバレルシフタのシフト幅に応じて、各Nビットゼロマスクが、左・右ゼロマスク、全Nビット0又は全Nビット1となるように、各M個のゼロマスク制御部を拡張し、ゼロマスク制御部を制御するゼロマスク拡張部を設けることにより、Pビットバレルシフタ用にPビットのゼロマスクを生成するゼロマスク制御部とPビットのAND回路とを削減できる。   In this way, each N-bit zero mask has a left / right zero mask and all N bits according to the shift width of the P-bit barrel shifter in a zero mask control unit that generates an N-bit zero mask for logical shift of M N-bit barrel shifters. Zero mask control for generating a P bit zero mask for a P bit barrel shifter by extending each M number of zero mask control units to 0 or all N bits 1 and providing a zero mask extension unit for controlling the zero mask control unit And P-bit AND circuits can be reduced.

なお、上記各実施形態は本発明の好適の一例であり、本発明はこれらに限定されることなく様々な変形が可能である。   Each of the above embodiments is a preferred example of the present invention, and the present invention is not limited to these and can be variously modified.

本発明に係るPビットバレルシフタの構成を示す図である。It is a figure which shows the structure of the P bit barrel shifter which concerns on this invention. 本発明を好適に実施した第1の実施形態に係るPビットバレルシフタの構成を示すである。1 shows a configuration of a P-bit barrel shifter according to a first embodiment in which the present invention is preferably implemented. Nビットバレルシフタの構成を示す図である。It is a figure which shows the structure of an N bit barrel shifter. Nビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of an N bit barrel shifter. 2個の4ビットバレルシフタを組み合わせ、左ローテート(シフト)時に利用するセレクト信号を示す図である。It is a figure which shows the select signal utilized at the time of left rotation (shift) combining two 4-bit barrel shifters. 8個の4ビットバレルシフタを組み合わせ、左ローテート(シフト)させた際の4to1セレクタの制御信号を示す図である。It is a figure which shows the control signal of the 4to1 selector at the time of combining eight 8-bit barrel shifters and carrying out left rotation (shift). 4ビットバレルシフタで左ローテート(シフト)時に生成される左右ゼロマスクを示す図である。It is a figure which shows the right-and-left zero mask produced | generated at the time of left rotation (shift) with a 4-bit barrel shifter. 第1の実施形態に係るPビットバレルシフタ(左ローテート(シフト)のみを実行)に適用されるNビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of the N bit barrel shifter applied to the P bit barrel shifter (only the left rotation (shift) is executed) according to the first embodiment. 第1の実施形態に係るPビットバレルシフタ(左ローテート(シフト)のみを実行)に適用されるシフト量制御部の構成を示す図である。It is a figure which shows the structure of the shift amount control part applied to the P bit barrel shifter (only the left rotation (shift) is performed) which concerns on 1st Embodiment. 8個の4ビットバレルシフタを組み合わせ、右ローテート(シフト)させた際の4to1セレクタの制御信号を示す図である。It is a figure which shows the control signal of a 4to1 selector at the time of combining eight 8-bit barrel shifters and carrying out a right rotation (shift). 4ビットバレルシフタで右ローテート(シフト)時に生成される左右ゼロマスクを示す図である。It is a figure which shows the right-and-left zero mask produced | generated at the time of a right rotation (shift) with a 4-bit barrel shifter. 第1の実施形態に係るPビットバレルシフタ(左右ローテート(シフト)を実行)に適用されるNビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of the N bit barrel shifter applied to P bit barrel shifter (execution of right-and-left rotation (shift)) which concerns on 1st Embodiment. 第1の実施形態に係るPビットバレルシフタ(左右ローテート(シフト)を実行)に適用されるシフト量制御部の構成を示す図である。It is a figure which shows the structure of the shift amount control part applied to P bit barrel shifter (execution of right-and-left rotation (shift)) which concerns on 1st Embodiment. 第1の実施形態に係るPビットバレルシフタに適用されるゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part applied to the P bit barrel shifter which concerns on 1st Embodiment. 第1の実施形態に係るPビットバレルシフタに適用されるゼロマスク生成部の構成を示す図である。It is a figure which shows the structure of the zero mask production | generation part applied to the P bit barrel shifter which concerns on 1st Embodiment. 本発明を好適に実施した第2の実施形態に係るPビットバレルシフタの構成を示す図である。It is a figure which shows the structure of the P bit barrel shifter which concerns on 2nd Embodiment which implemented this invention suitably. 2個の4ビットバレルシフタを単純に組み合わせて左論理シフトさせた結果を示す図である。It is a figure which shows the result of having carried out the left logical shift simply by combining two 4-bit barrel shifters. 2個の4ビットバレルシフタを単純に組み合わせて右論理シフトさせた結果を示す図である。It is a figure which shows the result of having carried out the right logic shift by simply combining two 4-bit barrel shifters. 第2の実施形態に係るPビットバレルシフタが備える2個の4ビットバレルシフタの左論理シフト結果を示す図である。It is a figure which shows the left logical shift result of two 4-bit barrel shifters with which the P bit barrel shifter which concerns on 2nd Embodiment is provided. 第2の実施形態に係るPビットバレルシフタが備える2個の4ビットバレルシフタの右論理シフト結果を示す図である。It is a figure which shows the right logical shift result of two 4-bit barrel shifters with which the P bit barrel shifter which concerns on 2nd Embodiment is provided. 第2の実施形態に係るPビットバレルシフタに適用されるNビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of the N bit barrel shifter applied to the P bit barrel shifter which concerns on 2nd Embodiment. 4個の4ビットバレルシフタを組み合わせて左論理シフトさせた結果を示す図である。It is a figure which shows the result of having carried out the left logical shift combining 4 4-bit barrel shifters. 第2の実施形態に係るPビットバレルシフタ(左論理シフトのみを実行)に適用されるゼロマスク拡張部の構成を示す図である。It is a figure which shows the structure of the zero mask extension part applied to P bit barrel shifter (only the left logical shift is performed) concerning 2nd Embodiment. 4個の4ビットバレルシフタを組み合わせて右論理シフトさせた結果を示す図である。It is a figure which shows the result of having carried out the right logic shift combining 4 4-bit barrel shifters. 第2の実施形態に係るPビットバレルシフタ(左右論理シフトを実行)に適用されるゼロマスク拡張部の構成を示す図である。It is a figure which shows the structure of the zero mask extension part applied to the P bit barrel shifter (execution of a left-right logical shift) concerning a 2nd embodiment. 第2の実施形態に係るPビットバレルシフタに適用されるNビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of the N bit barrel shifter applied to the P bit barrel shifter which concerns on 2nd Embodiment. 4ビットバレルシフタの構成を示す図である。It is a figure which shows the structure of a 4-bit barrel shifter. 4ビットバレルシフタのシフト量制御部の構成を示す図である。It is a figure which shows the structure of the shift amount control part of a 4-bit barrel shifter. 4ビットバレルシフタのゼロマスク制御部の構成を示す図である。It is a figure which shows the structure of the zero mask control part of a 4-bit barrel shifter. 二つの4ビットバレルシフタを組み合わせた8ビットバレルシフタの構成を示す図である。It is a figure which shows the structure of the 8-bit barrel shifter which combined two 4-bit barrel shifters.

符号の説明Explanation of symbols

1、301、701 Nビットバレルシフタ
2、302、702 Mto1セレクタ
3、103、205、303、703、3011 シフト量制御部
10、300、700 Pビットバレルシフタ
100、201、202 4ビットバレルシフタ
101、102、3010 2to1セレクタ
104、206、304、800、803、3012 ゼロマスク制御部
105、600、3014 ゼロマスク生成部
106、400、500、601、807、3015 左右ゼロマスクセレクタ
107、401、501、602、801、3016 ワンマスクセレクタ
108、207、305、3013 AND回路
200 8ビットバレルシフタ
203、204、402、502、604、802、804、805、806、808、902、903、1000、1001、1100、1101、1102 セレクタ
403、504 Tビット入力のAND素子
404、505 4to1セレクタ
503 否定的排他論理和
603、900、901 減算器
605 デコーダ
606 NOT回路
704 ゼロマスク拡張部
1, 301, 701 N-bit barrel shifter 2, 302, 702 Mto1 selector 3, 103, 205, 303, 703, 3011 Shift amount control unit 10, 300, 700 P-bit barrel shifter 100, 201, 202 4-bit barrel shifter 101, 102, 3010 2to1 selector 104, 206, 304, 800, 803, 3012 Zero mask control unit 105, 600, 3014 Zero mask generation unit 106, 400, 500, 601, 807, 3015 Left and right zero mask selectors 107, 401, 501, 602, 801, 3016 One mask selector 108, 207, 305, 3013 AND circuit 200 8-bit barrel shifter 203, 204, 402, 502, 604, 802, 804, 805, 806, 808, 902, 903, 10 0,1001,1100,1101,1102 selector 403,504 T-bit input of the AND element 404,505 4-to-1 selector 503 negative exclusive 603,900,901 subtractor 605 decoder 606 NOT circuit 704 zero mask extension

Claims (11)

M個のN(2のべき乗)ビットバレルシフタを組み合わせによってP(=M×N)ビットのバレルシフトを行うバレルシフタ装置であって、
P個のMto1セレクタと、
シフト方向とシフト幅とに基づいて、前記各Mto1セレクタのセレクト信号を生成するシフト量制御部とを備え、
下位K番目の前記Mto1セレクタには、M個のNビットバレルシフタの下位(K mod N)ビット目のシフト結果が接続されており、
前記シフト量制御部が生成した下位K番目のMto1セレクタのセレクト信号がLである場合に、下位K番目のMto1セレクタは、下位R(K/N≧Lの場合はR=K/N-L、K/N<Lの場合にはR=K/N-L+M)番目のNビットバレルシフタの下位(K mod N)番目のシフト結果を選択し、下位K番目のMto1セレクタの選択結果を、Pビットバレルシフタの下位Kビット目のシフト結果とすることを特徴とするバレルシフタ装置。
A barrel shifter device that performs barrel shift of P (= M × N) bits by combining M N (powers of 2) bit barrel shifters,
P Mto1 selectors,
A shift amount control unit that generates a select signal of each Mto1 selector based on a shift direction and a shift width;
The lower Kth Mto1 selector is connected to the lower (K mod N) bit shift result of M N-bit barrel shifters,
When the select signal of the lower K-th Mto1 selector generated by the shift amount control unit is L, the lower K-th Mto1 selector has the lower R (R = K / NL, K if K / N ≧ L, K When / N <L, the lower (K mod N) th shift result of the (R = K / N-L + M) th N-bit barrel shifter is selected, and the selection result of the lower Kth Mto1 selector is selected as P A barrel shifter device characterized in that a shift result of the lower K bits of the bit barrel shifter is used.
前記Nビットバレルシフタの各々は、
左右方向のローテートに加え、左右方向の論理シフトを実行可能であり、
左論理シフト用のNビット左ゼロマスクと右論理シフト用Nビット右ゼロマスクとを生成するNビットゼロマスク生成部と、
前記Nビット左ゼロマスクと前記Nビット右ゼロマスクを選択するNビットのNビット左右ゼロマスクセレクタと、
前記Nビット左右ゼロマスクセレクタの選択結果と、左右方向のローテート用の全ビットが1であるNビットのワンマスクとを選択するNビットのNビットシフトマスクセレクタと、
前記Nビットシフトマスクセレクタの選択結果と前記Nビットバレルシフタのシフト結果との論理積を生成するNビットアンド回路を備えることを特徴とする請求項1記載のバレルシフタ装置。
Each of the N-bit barrel shifters
In addition to rotating in the horizontal direction, it is possible to perform a logical shift in the horizontal direction,
An N-bit zero mask generator for generating an N-bit left zero mask for left logical shift and an N-bit right zero mask for right logical shift;
An N-bit N-bit left and right zero mask selector for selecting the N-bit left zero mask and the N-bit right zero mask;
An N-bit N-bit shift mask selector that selects a selection result of the N-bit left and right zero mask selector and an N-bit one mask in which all bits for rotation in the left-right direction are 1.
2. The barrel shifter device according to claim 1, further comprising an N-bit AND circuit that generates a logical product of a selection result of the N-bit shift mask selector and a shift result of the N-bit barrel shifter.
前記シフト量制御部は、
任意の前記Nビットバレルシフタが備える前記Nビット左ゼロマスクと前記Nビット右ゼロマスクと前記Nビット左右ゼロマスクセレクタとを用いて、下位K番目の前記Mto1セレクタのH(=[log2M]、[log2M]はlog2Mを超えない最大の整数)ビットからなるセレクト信号を生成し、
左にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位0ビット目は、シフト量swPの下位Q(=[log2N]、[log2N]はlog2Nを超えない最大の整数)ビット目が0である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目が1である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、
右にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位0ビット目は、シフト量swPの下位Qビット目が0である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目が1である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択することを特徴とする請求項2記載のバレルシフタ装置。
The shift amount control unit
Using the N-bit left zero mask, the N-bit right zero mask, and the N-bit left and right zero mask selector included in any of the N-bit barrel shifters, H (= [log2M], [log2M] of the lower K-th Mto1 selector is Generate a select signal consisting of (the largest integer not exceeding log2M) bits,
The lower 0th bit of the select signal of the lower Kth Mto1 selector when shifting the swP bit to the left is the lower Q of the shift amount swP (= [log2N], [log2N] is the largest integer not exceeding log2N) bits When the eye is 0, the lower (K mod N) bit of the N bit right zero mask selected using the N bit left and right zero mask selector is selected, and the lower Q bit of the shift amount swP is 1. In this case, the lower (K mod N) bit of the N bit left zero mask selected using the N bit left and right zero mask selector is selected,
When the lower K bit of the select signal of the lower K-th Mto1 selector when shifting the swP bit to the right is used, when the lower Q bit of the shift amount swP is 0, the N-bit left and right zero mask selector is used. When the lower (K mod N) bit of the selected N bit left zero mask is selected and the lower Q bit of the shift amount swP is 1, the N bit selected using the N bit left and right zero mask selector 3. The barrel shifter device according to claim 2, wherein the lower (K mod N) bit of the right zero mask is selected.
左にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位Tビット目として、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1でなく、且つ下位(Q+T)ビット目が0である場合には0を選択し、シフト量swPの下位Qビット目から下位(Q+T-1)ビット目までのビットが全て1でなく、且つ下位(Q+T)ビット目が1である場合には前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が0である場合には1を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が1である場合には前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、
右にswPビットシフトする際の下位K番目のMto1セレクタのセレクト信号の下位Tビット目として、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1ではなく、かつ下位(Q+T)ビット目が0である場合には0を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1ではなく、且つ下位(Q+T)ビット目が1である場合には前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が0である場合には1を選択し、シフト量swPの下位Qビット目から下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が1である場合には前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択することを特徴とする請求項3記載のバレルシフタ装置。
All the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are the lower T bits of the select signal of the lower K-th Mto1 selector when shifting the swP bits to the left If it is not 1 and the lower (Q + T) bit is 0, 0 is selected, and all the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 If the low-order (Q + T) bit is 1, the low-order (K mod N) bit of the N-bit right zero mask is selected, and the low-order (Q + T-1) When all the bits up to the 1st bit are 1 and the lower (Q + T) bit is 0, select 1, and from the lower Q bit of the shift amount swP, the lower (Q + T -1) When all the bits up to the first bit are 1 and the lower (Q + T) bit is 1, select the lower (K mod N) bit of the N bit left zero mask,
All the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 as the lower T bits of the select signal of the lower Kth Mto1 selector when shifting the swP bits to the right If the lower (Q + T) bit is 0, 0 is selected, and all the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 If the low-order (Q + T) bit is 1, the low-order (K mod N) bit of the N-bit left zero mask is selected, and the low-order (Q + T-1) If all the bits up to the 1st bit are 1 and the lower (Q + T) bit is 0, select 1 and select the lower (Q + T- 1) When all the bits up to the first bit are 1 and the lower (Q + T) bit is 1, the lower (K mod N) bit of the N bit right zero mask is selected. The barrel shifter device according to claim 3.
左論理シフト用のPビット左ゼロマスクと右論理シフト用のPビット右ゼロマスクとを生成するPビットゼロマスク生成部と、前記Pビット左ゼロマスクと前記Pビット右ゼロマスクとを選択するPビット左右ゼロマスクセレクタと、前記Pビット左右ゼロマスクセレクタの選択結果と左右方向のローテート用の全ビットが1であるPビットのワンマスクとを選択するPビットのPビットシフトマスクセレクタと、前記P個のMto1セレクタの出力と前記Pビットシフトマスクセレクタの選択結果との論理積を生成するPビットアンド回路とを備え、左右方向のローテートに加え左右方向の論理シフトを行うことを特徴とする請求項1から4のいずれか1項記載のバレルシフタ装置。   A P-bit zero mask generator for generating a P-bit left zero mask for left logical shift and a P-bit right zero mask for right logical shift; and a P-bit left and right zero mask selector for selecting the P-bit left zero mask and the P-bit right zero mask A P-bit P-bit shift mask selector that selects a selection result of the P-bit left and right zero mask selector and a P-bit one mask in which all the bits for rotation in the left-right direction are 1, and the P Mto1 selectors 5. A P-bit AND circuit that generates a logical product of an output and a selection result of the P-bit shift mask selector, and performs a logical shift in the left-right direction in addition to the rotate in the left-right direction. The barrel shifter apparatus of any one of Claims. 前記Nビットバレルシフタの各々は、前記Nビット左ゼロマスクと前記Nビット右ゼロマスクの少なくとも一方の全ビットが0となるように前記Nビットゼロマスク生成部の制御信号を選択するゼロマスク生成制御信号セレクタと、全ビットが0である前記Nビット左ゼロマスク又は前記Nビット右ゼロマスクを選択するように前記Nビット左右ゼロマスクセレクタの制御信号を選択する左右ゼロマスク制御信号セレクタと、前記各Nビットバレルシフタで実行するシフトがローテート及び論理シフトのいずれであるかを指定するシフトモードを選択するシフトモードセレクタと、M個の前記ゼロマスク制御信号を生成するゼロマスク拡張部とを備えることを特徴とする請求項2から4のいずれか1項記載のバレルシフタ装置。   Each of the N bit barrel shifters includes a zero mask generation control signal selector that selects a control signal of the N bit zero mask generation unit so that at least one of the N bit left zero mask and the N bit right zero mask is all zero. Left and right zero mask control signal selector for selecting the control signal of the N bit left and right zero mask selector so as to select the N bit left zero mask or the N bit right zero mask whose all bits are 0, and a shift executed by each N bit barrel shifter 5. A shift mode selector that selects a shift mode that designates whether the rotation is a rotation or a logical shift, and a zero mask extension that generates the M zero mask control signals. The barrel shifter apparatus of any one of Claims. Aビット左右ローテートを実行する際には、前記各Nビットバレルシフタのシフトモードが左右ローテートとなるように前記ゼロマスク拡張部が前記シフトモードセレクタを制御し、
Aビット左論理シフトを実行する際には、下位B番目の前記Nビットバレルシフタに対して、(N×(M−B−1))>Aである場合には、シフトモードが左ローテートとなるように前記ゼロマスク拡張部が前記シフトモードセレクタを制御し、(N×(M−B))>A≧(N×(M−B−1))である場合には、シフトモードが左論理シフトとなるように前記ゼロマスク拡張部が前記シフトモードセレクタを制御し、A≧(N×(M−B))である場合には、下位B番目の前記Nビットバレルシフタの前記Nビットゼロマスク生成部が生成する前記Nビット左ゼロマスクと前記Nビット右ゼロマスクとの少なくとも一方の全ビットが0となるように前記ゼロマスク拡張部が前記ゼロマスク生成制御信号セレクタを制御し、前記Nビット左右セレクタが全ビット0である前記Nビット左ゼロマスク又は前記Nビット右ゼロマスクを選択するように、前記ゼロマスク拡張部が前記左右ゼロマスク制御信号セレクタを制御し、
Aビット右論理シフトを実行する際に、下位B番目の前記Nビットバレルシフタに対して(N×B)>Aである場合には、シフトモードが右ローテートとなるように前記ゼロマスク拡張部が前記シフトモードセレクタを制御し、(N×(B+1))>A≧(N×B)である場合には、シフトモードが右論理シフトとなるように前記ゼロマスク拡張部が前記シフトモードセレクタを制御し、A≧(N×(B+1))である場合には、下位B番目の前記Nビットバレルシフタの前記Nビットゼロマスク生成部が生成する前記Nビット左ゼロマスクと前記Nビット右ゼロマスクとの少なくとも一方が全て0となるように、Pビットゼロマスク制御部が前記ゼロマスク生成制御信号セレクタを制御し、前記Nビット左ゼロマスクと前記Nビット右ゼロマスクとの少なくとも一方の全ビットが0となるように前記ゼロマスク拡張部が前記ゼロマスク生成制御信号セレクタを制御し、前記Nビット左右ゼロマスクセレクタが、全ビットが0である前記Nビット左ゼロマスク又は前記Nビット右ゼロマスクを選択するように、前記ゼロマスク拡張部が前記左右ゼロマスク制御信号セレクタを制御することを特徴とする請求項6項記載のバレルシフタ装置。
When performing A-bit left / right rotation, the zero mask extension unit controls the shift mode selector so that the shift mode of each N-bit barrel shifter is left / right rotation,
When an A-bit left logical shift is performed, if (N × (M−B−1))> A for the lower B-th N-bit barrel shifter, the shift mode is left rotate. Thus, when the zero mask extension controls the shift mode selector and (N × (MB))> A ≧ (N × (MB−1)), the shift mode is left logical shift. The zero mask extension unit controls the shift mode selector so that, when A ≧ (N × (MB)), the N bit zero mask generation unit of the lower Bth N bit barrel shifter The zero mask extension unit controls the zero mask generation control signal selector so that at least one of at least one of the N bit left zero mask and the N bit right zero mask to be generated becomes 0, and the N bit left and right set Kuta is to select the N-bit left zero mask or said N-bit right zero mask is all zero, the zero mask expansion unit controls the left and right zero mask control signal selector,
When performing an A-bit right logical shift, if (N × B)> A with respect to the lower B-th N-bit barrel shifter, the zero mask extension is set so that the shift mode is right rotate. If the shift mode selector is controlled and (N × (B + 1))> A ≧ (N × B), the zero mask extension unit controls the shift mode selector so that the shift mode is a right logical shift. , A ≧ (N × (B + 1)), at least one of the N-bit left zero mask and the N-bit right zero mask generated by the N-bit zero mask generation unit of the lower B-th N-bit barrel shifter is A P-bit zero mask control unit controls the zero mask generation control signal selector so that all bits become zero, and the N bit left zero mask and the N bit right zero mask are controlled. The zero mask extension unit controls the zero mask generation control signal selector so that at least one of all the bits of the N bit is zero, and the N bit left and right zero mask selector 7. The barrel shifter according to claim 6, wherein the zero mask extension unit controls the left and right zero mask control signal selectors so as to select an N-bit right zero mask.
前記シフト量制御部は、
左論理シフト実行時には、下位0番目の前記NビットバレルシフタのNビット左ゼロマスクと前記Nビット右ゼロマスクと前記Nビット左右ゼロマスクのセレクト結果とを用いて、前記Nビットバレルシフタを組み合わせたPビットバレルシフタの論理シフトを実現し、
右論理シフト実行時には、下位(M−1)番目の前記Nビットバレルシフタの前記Nビット左マスクと前記Nビット右ゼロマスクと前記Nビット左右ゼロマスクのセレクト結果とを用いて、前記Nビットバレルシフタを組み合わせたPビットバレルシフタの論理シフトを実現することを特徴とする請求項7記載のバレルシフタ装置。
The shift amount control unit
When the left logical shift is executed, the selection result of the N-bit left zero mask, the N-bit right zero mask, and the N-bit left and right zero mask of the lower 0th N-bit barrel shifter is used to combine the N-bit barrel shifter with the P-bit barrel shifter. Realize logical shift,
When executing the right logical shift, the N bit barrel shifter is combined using the N bit left mask, the N bit right zero mask, and the N bit left and right zero mask selection results of the lower (M-1) th N bit barrel shifter. 8. The barrel shifter device according to claim 7, wherein a logical shift of the P-bit barrel shifter is realized.
M個のN(2のべき乗)ビットバレルシフタを組み合わせによってP(=M×N)ビットのバレルシフトを行うバレルシフト方法であって、
P個のMto1セレクタのうち下位K番目のセレクタに、M個のNビットバレルシフタの下位(K mod N)ビット目のシフト結果を接続し、
シフト方向とシフト幅とに基づいて生成された下位K番目のMto1セレクタのセレクト信号がLである場合に、下位K番目のMto1セレクタによって下位R(K/N≧Lの場合はR=K/N-L、K/N<Lの場合にはR=K/N-L+M)番目のNビットバレルシフタの下位(K mod N)番目のシフト結果を選択し、下位K番目のMto1セレクタの選択結果を、Pビットバレルシフタの下位Kビット目のシフト結果とすることを特徴とするバレルシフト方法。
A barrel shift method for performing barrel shift of P (= M × N) bits by combining M N (power of 2) bit barrel shifters,
The shift result of the lower (K mod N) bits of the M N-bit barrel shifters is connected to the lower K-th selector among the P Mto1 selectors,
When the select signal of the lower Kth Mto1 selector generated based on the shift direction and the shift width is L, the lower Kth Mto1 selector selects the lower R (if K / N ≧ L, R = K / When NL, K / N <L, R = K / N-L + M) Selects the lower (K mod N) th shift result of the Nth bit shifter and shifts the lower Kth Mto1 selector Is a result of shifting the lower K bits of the P-bit barrel shifter.
任意の前記Nビットバレルシフタが備える左論理シフト用のNビット左ゼロマスクと、右論理シフト用のNビット右ゼロマスクと、前記Nビット左ゼロマスクと前記Nビット右ゼロマスクを選択するNビット左右ゼロマスクセレクタとを用いて、下位K番目の前記Mto1セレクタのH(=[log2M])ビットからなるセレクト信号を生成し、
左にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位0ビット目は、シフト量swPの下位Q(=[log2N])ビット目が0である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目が1である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、

右にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位0ビット目は、シフト量swPの下位Qビット目が0である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目が1である場合には、前記Nビット左右ゼロマスクセレクタを用いて選択した前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択することを特徴とする請求項9記載のバレルシフト方法。
An N-bit left zero mask for left logical shift, an N-bit right zero mask for right logical shift, an N-bit left and right zero mask selector for selecting the N-bit left zero mask and the N-bit right zero mask, which are included in any of the N-bit barrel shifters; Is used to generate a select signal consisting of the H (= [log2M]) bits of the lower K-th Mto1 selector,
The lower 0 bit of the select signal of the lower Kth Mto1 selector when shifting the swP bit to the left is the N bit when the lower Q (= [log2N]) bit of the shift amount swP is 0. When the lower (K mod N) bit of the N bit right zero mask selected using the left and right zero mask selector is selected and the lower Q bit of the shift amount swP is 1, the N bit left and right zero mask selector is used. Selecting the lower (K mod N) bit of the N bit left zero mask selected in

When the lower K bit of the select signal of the lower K-th Mto1 selector when shifting the swP bit to the right is used, when the lower Q bit of the shift amount swP is 0, the N-bit left and right zero mask selector is used. When the lower (K mod N) bit of the selected N bit left zero mask is selected and the lower Q bit of the shift amount swP is 1, the N bit selected using the N bit left and right zero mask selector 10. The barrel shift method according to claim 9, wherein the lower (K mod N) bit of the right zero mask is selected.
左にswPビットシフトする際の下位K番目の前記Mto1セレクタのセレクト信号の下位Tビット目として、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1でなく、且つ下位(Q+T)ビット目が0である場合には0を選択し、シフト量swPの下位Qビット目から下位(Q+T-1)ビット目までのビットが全て1でなく、且つ下位(Q+T)ビット目が1である場合には前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が0である場合には1を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が1である場合には前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、
右にswPビットシフトする際の下位K番目のMto1セレクタのセレクト信号の下位Tビット目として、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1ではなく、かつ下位(Q+T)ビット目が0である場合には0を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1ではなく、且つ下位(Q+T)ビット目が1である場合には前記Nビット左ゼロマスクの下位(K mod N)ビット目を選択し、シフト量swPの下位Qビット目から、下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が0である場合には1を選択し、シフト量swPの下位Qビット目から下位(Q+T-1)ビット目までのビットが全て1、且つ下位(Q+T)ビット目が1である場合には前記Nビット右ゼロマスクの下位(K mod N)ビット目を選択することを特徴とする請求項10記載のバレルシフト方法。
All the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are the lower T bits of the select signal of the lower K-th Mto1 selector when shifting the swP bits to the left If it is not 1 and the lower (Q + T) bit is 0, 0 is selected, and all the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 If the low-order (Q + T) bit is 1, the low-order (K mod N) bit of the N-bit right zero mask is selected, and the low-order (Q + T-1) When all the bits up to the 1st bit are 1 and the lower (Q + T) bit is 0, select 1, and from the lower Q bit of the shift amount swP, the lower (Q + T -1) When all the bits up to the first bit are 1 and the lower (Q + T) bit is 1, select the lower (K mod N) bit of the N bit left zero mask,
All the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 as the lower T bits of the select signal of the lower Kth Mto1 selector when shifting the swP bits to the right If the lower (Q + T) bit is 0, 0 is selected, and all the bits from the lower Q bit to the lower (Q + T-1) bit of the shift amount swP are 1 If the low-order (Q + T) bit is 1, the low-order (K mod N) bit of the N-bit left zero mask is selected, and the low-order (Q + T-1) If all the bits up to the 1st bit are 1 and the lower (Q + T) bit is 0, select 1 and select the lower (Q + T- 1) When all the bits up to the first bit are 1 and the lower (Q + T) bit is 1, the lower (K mod N) bit of the N bit right zero mask is selected. The barrel shift method according to claim 10.
JP2008314895A 2008-12-10 2008-12-10 Barrel shifter device and barrel shift method Expired - Fee Related JP5182053B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008314895A JP5182053B2 (en) 2008-12-10 2008-12-10 Barrel shifter device and barrel shift method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008314895A JP5182053B2 (en) 2008-12-10 2008-12-10 Barrel shifter device and barrel shift method

Publications (2)

Publication Number Publication Date
JP2010140192A true JP2010140192A (en) 2010-06-24
JP5182053B2 JP5182053B2 (en) 2013-04-10

Family

ID=42350293

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008314895A Expired - Fee Related JP5182053B2 (en) 2008-12-10 2008-12-10 Barrel shifter device and barrel shift method

Country Status (1)

Country Link
JP (1) JP5182053B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9021000B2 (en) 2012-06-29 2015-04-28 International Business Machines Corporation High speed and low power circuit structure for barrel shifter

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04361325A (en) * 1991-06-07 1992-12-14 Sony Corp Barrel shifter device
JPH1055262A (en) * 1996-08-08 1998-02-24 Toshiba Corp Shift circuit
JPH10512069A (en) * 1994-12-01 1998-11-17 インテル・コーポレーション Processor that performs shift operation on packed data
JPH11119976A (en) * 1997-10-15 1999-04-30 Toshiba Corp Data dividing parallel shifter
US6243808B1 (en) * 1999-03-08 2001-06-05 Chameleon Systems, Inc. Digital data bit order conversion using universal switch matrix comprising rows of bit swapping selector groups
US20030131029A1 (en) * 2002-01-08 2003-07-10 Bandy James Henry Barrel shifter
JP2006338684A (en) * 2006-08-01 2006-12-14 Matsushita Electric Ind Co Ltd Processor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04361325A (en) * 1991-06-07 1992-12-14 Sony Corp Barrel shifter device
JPH10512069A (en) * 1994-12-01 1998-11-17 インテル・コーポレーション Processor that performs shift operation on packed data
JPH1055262A (en) * 1996-08-08 1998-02-24 Toshiba Corp Shift circuit
JPH11119976A (en) * 1997-10-15 1999-04-30 Toshiba Corp Data dividing parallel shifter
US6243808B1 (en) * 1999-03-08 2001-06-05 Chameleon Systems, Inc. Digital data bit order conversion using universal switch matrix comprising rows of bit swapping selector groups
US20030131029A1 (en) * 2002-01-08 2003-07-10 Bandy James Henry Barrel shifter
JP2006338684A (en) * 2006-08-01 2006-12-14 Matsushita Electric Ind Co Ltd Processor

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9021000B2 (en) 2012-06-29 2015-04-28 International Business Machines Corporation High speed and low power circuit structure for barrel shifter
US9501260B2 (en) 2012-06-29 2016-11-22 International Business Machines Corporation High speed and low power circuit structure for barrel shifter
US9996317B2 (en) 2012-06-29 2018-06-12 International Business Machines Corporation High speed and low power circuit structure for barrel shifter

Also Published As

Publication number Publication date
JP5182053B2 (en) 2013-04-10

Similar Documents

Publication Publication Date Title
CN114402289B (en) Multi-mode arithmetic circuit
US5542074A (en) Parallel processor system with highly flexible local control capability, including selective inversion of instruction signal and control of bit shift amount
WO2013057872A1 (en) Shuffle pattern generating circuit, processor, shuffle pattern generating method, and instruction
JP2002512398A (en) Method and apparatus for performing a shift operation on packed data
JP2018200692A (en) Arrangement sorting method in vector processor
CN114128148A (en) Fused memory and arithmetic circuit
CN114930311A (en) Cascade communication between FPGA repeating units
JPWO2019189878A1 (en) Arithmetic logic unit and arithmetic system
JP2008535077A (en) Number multiplier signed in canonical form
JP5182053B2 (en) Barrel shifter device and barrel shift method
JP4011007B2 (en) Integrated circuit device and processing device having reconfigurable circuit
JP2002229970A (en) Simd product sum operation method, sum of product sum arithmetic circuit and semiconductor integrated circuit device
JP4260197B2 (en) Processing equipment
US7433912B1 (en) Multiplier structure supporting different precision multiplication operations
JP5253406B2 (en) Digital electronic binary rotator and inverter
JP3562373B2 (en) Zero judgment signal generation circuit
JP4413052B2 (en) Data flow graph processing apparatus and processing apparatus
JP4330472B2 (en) Processing equipment
JP2009181509A (en) Processing circuit
WO2001075635A2 (en) Dsp execution unit for efficient alternate modes of operation
US10289382B2 (en) Selectively combinable directional shifters
JP4357326B2 (en) Reconfigurable circuit and processing device
JPH02115929A (en) Multiplier
JP5025509B2 (en) Arithmetic processing circuit
JP5115307B2 (en) Semiconductor integrated circuit

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110908

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20110920

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20121218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20121231

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees