Background of the Invention
[0001] The present invention relates to an information processing apparatus having a mask
function, and particularly to an information processing apparatus having a mask function
for masking an undesired bit or bits from among a plurality of bits read out of a
memory.
[0002] An information processing apparatus, in general, manipulates a plurality of bits
altogether as the unit of processing which is defined as a byte or a word. For example,
an 8-bit processor accesses a memory byte by byte, i.e., 8 bits by 8 bits, using an
8-bit data bus. In a l6-bit processor, l6 bits (two bytes = one word) are simultaneously
manipulated.
[0003] However, there is a case that only a part of bits of a byte or a word are required
in order to execute a desired instruction. In this case, a bit or bits to be processed
must be selected from among a plurality of bits. Heretofore, this was done by a bit-shift
operation. However, the bit-shift operation requires a long period of time because
the non-selected bit or bits also have to be shifted bit by bit. On the other hand,
a mask operation has been proposed to select a part of the bits constituting a word
or a byte. On the mask operation, non-selected bit or bits are masked by using a mask
signal, and only a desired bit or bits are allowed to be taken out as valid bits.
However, the mask operation of the prior art has produced the mask signal by combining
a plurality of arithmetic instructions, so that complex processing and control are
necessary. For instance, in order to detect a position of a bit to be masked a complex
arithmetic calculation is required. When a plurality of bits are to be masked, the
mask operation of the prior art requires a long period of time.
Summary of the Invention
[0004] It is therefore an object of the present invention to provide an information processing
apparatus which can perform a mask operation at a high speed not only for a single
bit but for a plurality of bits.
[0005] An information processing apparatus of the present invention contains a first means
for storing a first data indicating a start bit position of a start bit from which
a processing is performed, a second means for storing a second data indicating an
end bit position of an end bit at which the processing is terminated, and a third
means coupled to the first means and the second means for producing a mask signal
according to the first data and the second data.
[0006] The first data and the second data consists of N bits, respectively. In the first
data, each bit from a first bit to a bit just before the start bit has a first level
signal, and each of the remaining bits, that is the start bit and the succeeding bit
or bits, has a second level signal. While, in the second data, each of a first bit
to the end bit has the second level signal, and the remaining bit or bits have the
first level signal. The third means compares the first data with the second data bit
by bit and produces a non-mask signal for each bit in which both the first data and
the second data have the second level signals and produces a mask signal for each
of the remaining bits. Thus, only the start bit to the end bit are not masked, while
the remaining bit or bits are wholly masked. The third means has, for example, N gate
circuits, each of which receives a bit of the first data and the corresponding bit
of the second data, and produces N signals containing the mask signal and the non-mask
signal. Here, one word or one byte is defined as consisting of N bits. The first means
and the second means have a table of N × N bits, respectively, as described hereinafter.
[0007] According to the present invention, the mask signal and the non-mask signal are produced
at a high speed without using the bit-shift operation and the complex arithmetic operation.
Particularly, mask signals for a plurality of bits can be produced at a high speed
by the present invention, and therefore the present invention is suitable for an information
processing apparatus in which each instruction is executed byte by byte or word by
word.
Brief Description of the Drawings:
[0008]
Fig. l is a diagram showing a memory map and a format of a data to be processed;
Fig. 2 is a block diagram showing an information processing apparatus of an embodiment
according to the present invention;
Figs. 3A and 3B are tables of generating circuits 4 and 5 generating mask signal and
a non-mask signal, respectively;
Fig. 4 is a circuit diagram of a gate circuit 6;
Fig. 5 is a circuit diagram of a control circuit l;
Fig. 6 is a diagram showing outputs of the memories 4 and 5 and the gate circuit 6;
Fig. 7 is a flow chart showing an example of a mask operation of the present invention;
and
Fig. 8 is a diagram showing outputs of the generating circuits 4 and 5 and the gate
circuit 6, respectively.
Detailed Description of the Preferred Embodiment
[0009] As shown in Fig. l, a memory having p columns and m rows is accessed by word (or
byte) addresses 0, l, 2, ... ; p, ... 2P-l, ... L, ... K, K+l, K+2, ... (mp-l). If
a word consists of l6 bits, information of l6 bits is simultaneously read out of or
written into the memory by one of the word addresses. It is assumed in this embodiment
that one word consists of l6 bits.
[0010] When 8 bits P2 to P9 among l6 bits P0 to Pl5 of a word L are required in an arithmetic
operation, P0, Pl and Pl0 to Pl5 must be masked.
[0011] Fig. 2 shows a block diagram of an information processing apparatus according to
an embodiment of the present invention. The apparatus contains a control circuit l,
two registers 2 and 3 coupled to the control circuit l, two memories 4 and 5 coupled
to the registers 2 and 3, respectively, a gate circuit 6 coupled to output terminals
of the memories 4 and 5, an arithmetic unit 7 coupled to the gate circuit 6, a command
generating unit 8 coupled to the arithmetic unit 7 and the control circuit l, and
a memory 9 shown in Fig. l. In this embodiment, the control circuit l, the registers
2 and 3, the memories 4 and 5, and the gate circuit 6 are provided to produce the
mask signal and the non-mask signal at the same time.
[0012] The memory 4 (ROM) stores a table shown in Fig. 3A and outputs l6-bit mask control
signals X₀ to X₁₅ in response to any one of l6 addresses (0 to F). The memory 5 (ROM)
also stores a table shown in Fig. 3B and outputs l6-bit mask control signals Y₀ to
Y₁₅ in response to an input data which is any one of l6 addresses (0 to F). The addresses
0 to F in Figs. 3A and 3B are represented by a hexadecimal digit. The bit numbers
of the mask control signals X₀ to X₁₅ and Y₀ to Y₁₅ are the same and equal to the
bit number of one word (l6 bits in this embodiment). Further, addresses of the memories
4 and 5 are also equal to the bits of one word in number. A start bit address designating
a bit position from which a processing is to start is applied to the memory 4, while
an end bit address designating a bit position at which the processing is to terminate
is applied to the memory 5. When a word containing the end bit position is different
from a word having the start bit position, the end bit address to be applied to the
memory 5 is F (l5) for the latter word and is calculated by using a bit length of
bits to be processed for the former word as described hereinafter. In Figs. 3A and
3B, "l" represents a non-mask control signal, while "0" represents a mask control
signal.
[0013] In the memory 4, "0" is stored from a first location X₀ to a location just before
a location corresponding to the start bit position, and "l" is stored from the location
corresponding to the start bit position to a last location X₁₅. In the memory 5, "l"
is stored from a first location Y₀ to a location corresponding to the end bit position,
and "0" is stored from a location subsequent to the location corresponding to the
end bit position to a last location Y₁₅. Thus, the memory 4 stores l6 first data,
each representing the start bit position, and the memory 5 stores l6 second data,
each representing the end bit position.
[0014] The output signals of the memories 4 and 5 are applied to the gate circuit 6 (Fig.
2) which produces a mask signal and a non-mask signal. The gate circuit 6 may be formed
by l6 AND gates (G0 to Gl5) as shown in Fig. 4, each of the AND gates receives the
output signal X
i for a word from the memory 4 and the output signal Y
i for the same word from the memory 5. Thus, only the AND gate or gates which receive
both "l" of the output signals X
i and Y
i produce the non-mask signal ("l"), and the remaining AND gate or gates produce the
mask signal ("0"), so that l6-bit mask control signal is generated for one word.
[0015] Fig. 5 shows a block diagram of the control circuit l having a register (dAD) l0
storing a bit address, a register (DH) storing a value representing a bit length to
be processed, a selector l2, a comparator l3, multiplexers l4, l6 and l8, an arithmetic
logic circuit l6 and a register l7. The control circuit l produces a first data representing
a start bit position of a data to be processed and a second data representing an end
bit position of the data to be processed. The first data and the second data are stored
in the registers 2 and 3 of Fig. 2, respectively, as addresses to be applied to the
memories 4 and 5. The control circuit l produces these first data and second data
according to the bit address representing the start bit position and the bit length
of the data to be processed, which are sent from the command generating unit 8.
[0016] The arithmetic unit 7 is coupled to the gate circuit 6, the memory 9 and the command
generating unit 8 and performs an arithmetic operation commanded by the unit 8 for
the data read out of the memory 9 by using the mask signal and the non-mask signal
outputted from the gate circuit 6. A central processing unit (CPU) can be employed
as the arithmetic unit 7, and a program memory and a decoder or sequencer are used
as the command generating unit 8.
[0017] An operation for producing the mask signal and the non-mask signal will be explained
with references to Figs. l to 6. An address of a start bit P2 to be processed for
the word L is "2", while an address of an end bit P9 is "9". Therefore, the value
"2" is set into the register 2, while the value "9" is set into the register 3. These
values can be directly set into the respective registers 2 and 3 when the start address
and the end address are preliminarily determined. However, when only the start address
and a bit length to be processed is determined, the control circuit l is used as described
hereinafter.
[0018] The memory 4 outputs a first data (00llllllllllllll) as X₀ to X₁₅ therefrom in response
to the content (the start address "2") of the register 2. While the memory 5 outputs
a second data (llllllllll000000) as Y₀ to Y₁₅ therefrom in response to a content (the
end address "9") of the register 3. These two data are applied to the gate circuit
shown in Fig. 4, whereby 00llllllll000000 are produced by the gate circuit 6 as M₀
to M₁₅. Here, "0" represents a mask signal and "l" represents a non-mask signal. Thus,
only P2 to P9 are selected among the l6-bit data of the word L as bits to be processed,
and the remaining bits (P0, Pl and Pl0 to Pl5) are masked in the arithmetic unit 7.
[0019] According to the present invention, arbitrary bit or bits can be masked at a high
speed by applying the start address and the end address to the registers 2 and 3,
respectively.
[0020] The present invention can be applied to mask arbitrary bit or bits from among a plurality
of successive words. For example, in Fig. l A9 in a first word K to C3 in a third
word K+2 can be selected at a high speed by the present invention. In this case, successive
three word addresses K, K+l and K+2 are sequentially applied to the memory 9. The
mask operation will be described with reference to Figs. l - 5 and 7 and 8.
[0021] The start bit A9 of the bits to be processed is indicated by the word address K and
the bit address "9". While, the end bit C3 is indicated by the word address K+2 and
the bit address "3". The command generating circuit 8 sends the start bit address
(dAD) "9" to the register l0 of the control circuit l and sends the value "26" representing
a bit length (DH) to be processed to the register ll, respectively (STEPS A and B).
The control circuit l compares a content of the register ll with a value "l6" by the
comparator l3 because one word consists of l6 bits (STEPS C and D). Since the content
of the register ll is larger than "l6" in this case, the content "9" of the register
l0 is applied to the register 2 via the selector l2. With respect to the word A0 to
Al5, since A9 to Al5 are to be processed, the value "l5" is selected by the selector
l2 and is applied to the register 3 as the end bit address of that word (STEP E).
At this time, 0000 0000 0lll llll is read out of the memory 4 as the output X₀ to
X₁₅, while llll llll llll llll is read out of the memory 5 as the output Y₀ to Y₁₅.
These outputs are ANDed by the gate circuit 6. As the result, 000000000lllllll is
outputted from the gate circuit 6, in which "0" represents a mask signal and "l" represents
a non-mask signal. Thus, A9 to Al5 are selected from l6-bit data A0 - Al5 of the word
K by the non-mask signal "l", and A0 to A8 are masked by the mask signal "0".
[0022] Next, l6-bit data B0 to Bl5 of the successive word K+l is read out of the memory
9. In order to detect the number of bits which have been processed in the first word
(K), the content of the register (dAD) l0 is subtracted from the value "l6" by the
ALU l6 in a STEP F. The result is stored in the register l7. Further, to correct the
bit length to be processed, the content "26" of the register ll is applied via multiplexer
l4 to the ALU l6. The content "7" of the register l7 is also applied via the multiplexer
l5 to the ALU l6. In the ALU l6, subtraction of "26" minus "7" is executed, and the
result "l9" is stored to the register ll via the multiplexer l8 (STEP G). Thereafter,
the content "l9" of the register is compared with the value "l6" by the comparator
l3 (STEP H). Since the content "l9" of the register ll is larger than "l6", the control
unit l determines that all bits B0 to Bl5 of the second word (K+l) must be processed.
Thus, the selector l2 applies "0" to the register 2 as the start bit address and applied
"l5(=F)" to the register 2 as the end bit address, respectively (STEP I). Consequently,
llll llll llll llll are read out of both memories 4 and 5, and therefore, the gate
circuit 6 produces llllllllllllllll (all non-mask signals) for the second word K+l.
Thus, the l6 bits B0 to Bl5 of the word K+l are all processed by the arithmetic unit
7.
[0023] In a STEP J, to produce a mask signal for the third word K+2 (l6-bit data C0 to Cl5)
read out of the memory 9, the content of the register (DH) ll is subtracted by the
value "l6" which is the number of bits to be processed for the second word K+l. The
result is "3" which is smaller than the value "l6". Therefore, "0" is sent to the
register 2 as the start bit of the third word, and "3" is sent to the register 3 as
the end address of the third word. Thus, llll llll llll llll is read out of the memory
4, and llll 0000 0000 0000 is read out of the memory 5, whereby the gate circuit 6
produces an output signal llll000000000000. As a result, first 4 bits C0 to C3 are
not masked for the third word K+2, while the remaining l2 bits C4 to Cl5 are masked.
[0024] As described above, the mask signal and the non-mask signal can be produced by a
table access operation at a high speed. Particularly, they can be produced bit by
bit without shifting operation. Further, since the arithmetic unit 7 does not participate
the mask signal producing operation, it can execute the arithmetic operation in parallel
with the mask signal producing operation.
[0025] In the present invention, when a word contains both the start bit and the end bit
as shown in the word L, the command generating circuit 8 may directly apply the start
bit and the end bit to the registers 2 and 3, respectively, without using the control
circuit l. Further, when the same address is applied to the memories 4 and 5, all
other bits except for only one bit are masked. On the other hand, when an address
larger than that applied to the memory 5 is applied to the memory 4, all bits can
be masked, and therefore, no operation (NOP) or a skip operation can be performed
by using this mask operation. Further, a random logic circuit (e.g. a PLA circuit,
an encoder circuit) may be used as the memories 4 and 5 to produce mask control signals
as shown in Figs. 3A and 3B.
1. An information processing apparatus comprising a memory from which a fixed plural
number of bits are read out at the same time in one read operation, an arithmetic
unit coupled to the memory and performing an arithmetic operation using a part or
all of the bits read out of said memory, and a mask signal producing circuit producing
a mask signal for masking a bit or bits among the bits read out of said memory, said
mask signal producing circuit having a first means for generating first mask control
signals consisting of said fixed number of bits which represent a start bit position
from which the arithmetic operation starts, a second means for generating second mask
control signals consisting of said fixed number of bits which represent an end bit
position at which said arithmetic operation is terminated, and a third means coupled
to said first means and said second means for producing said mask signal according
to said first mask control signals and said second mask control signals
2. An apparatus as claimed in claim l, wherein said fixed number is N.
3. An apparatus as claimed in claim 2, wherein said first mask control signals generated
from said first means contain lst to Nth signals in which i-th (l ≦ i ≦N) signal represents
the start bit position and said second l mask control signals generated from said
second means contain lst to Nth signals in which j-th (l ≦ j ≦ N) represents the end
bit position.
4. An apparatus as claimed in claim 3, wherein each of lst signal to (i-l)-th signal
of said first mask control signals is a first logic level signal, each of i-th signal
to Nth signal of them being a second logic level signal, each of said lst signal to
j-th signal of said second mask control signals being the second logic level signal,
and each of said (j+l)-th signal to N-th signal of said second mask control signals
being the first logic level signal, said third means producing the mask signal corresponding
the lst signal to (i-l)th signal and the (j+l)th signal to the Nth signal.
5. An apparatus as claimed in claim l, wherein said first means has a first table
memory storing said first mask control signals, said second means having a second
table memory storing said second mask control signals.
6. An apparatus having a mask function for masking a part of bit or bits from among
lst to n-th bits comprising a first means for generating a first data consisting of
X₀ to Xn signals in which X₀ to Xi-1 signals have a first logic and Xi to Xn signals have a second logic, a second means for generating a second data consisting
of Y₀ to Yn signal in which Y₀ to Yj signals have the second logic and Yj+1 to Yn signals have the first logic, Xi representing a start position of a bit or bits not to be masked, Yj representing an end position of the bit or bits not to be masked, and means coupled
to said first means and said second means for producing a mask signal for the lst
to (i-l)th bits and (j+l)-th to n-th bits and a non-mask signal for the i-th to j-th
bits according to said X₀ to Xn signals and said Y₀ to Yn signals.
7. An apparatus as claimed in claim 6, wherein said third means has lst to n-th gate
means, each gate means receiving the corresponding X signal and Y signal and producing
the non-mask signal when X signal and Y signal are both said second logics and the
mask signal when at least one of the X signal and the Y signal is said first logic.
8. An apparatus as claimed in claim 6, wherein said X₀ to Xn signals and said Y₀ to Yn signals are applied to said producing means at the same time.
9. An apparatus producing a mask signal and a non-mask signal for a plurality of bits
read out of a memory comprising a first means for generating a first data indicating
a start bit position from which a processing starts, a second means for generating
a second data indicating an end bit position at which the processing is terminated,
a third means coupled to said first means and said second means for activating said
first means and said second means according to a start bit address designating said
start bit position and an end bit address designating said end bit position, and a
third means coupled to said first means and said second means for producing the mask
signal of a bit or bits not to be processed and the non-mask signal of a bit or bits
to be processed according to said first data and said second data, respectively.
l0. An apparatus as claimed in claim 8, further comprising a fourth means receiving
said start bit address and a data representing a bit length of bits to be processed
for producing said end bit address according to said start bit address and said data
representing the bit length.