Read only memory capable of writing data and method of writing/reading data therefor
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a read only memory capable of writing data called a PROM (Programmable Read only Memory), particularly to an EEPROM (Electrically Erasable PROM) which is a read only storage element capable of writing data by an electrical operation and to the method of writing/reading data. 
     2. Description of Related Art 
     FIG. 1 is a block diagram showing a configuration of a conventional PROM as a read only memory capable of writing data, built in a general microcomputer. 
     In FIG. 1, reference numeral 1 designates a memory cell array as a memory unit for holding data, in which plural memory cells 1a are arranged in a state of matrix of row×column direction. 
     The memory cell array 1 is connected to a data bus DB through a data writing/reading (W/R) circuit 2 which is to be described later. In respective memory cells 1a, values of respective bits of respective data inputted from the data bus DB are written by the data writing/reading circuit 2, while the respective values stored in the respective memory cells 1a are read out to the data bus DB as the values of respective bits of the data. 
     Respective memory cells 1a in the memory cell array 1 are arranged in a state of matrix, as aforementioned. The memory cells 1a in the respective rows (columns) direction are connected to the respective common word lines 7, and the respective memory cells 1a in the respective columns (rows) direction are connected to the respective common bit lines 6. Accordingly, each memory cell 1a is connected to any one word line 7 and any one bit line 6. 
     Each word line 7 is connected to a word select circuit 20 and each bit line 6 is to the data writing/reading circuit 2. 
     To the data writing/reading circuit 2, a data read signal (hereinafter to be called a DR signal) line 3, a data writing pulse signal (hereinafter to be called a PGM signal) line 4 and a power source line 5 are connected. 
     The power source line 5 supplies a data writing voltage V pp  to the data writing/reading circuit 2. When the DR signal given to the data writing/reading circuit 2 by the DR signal line 3 becomes active, data is read from the respective memory cells 1a of one row (column) connected to one word line 7 of the memory cell array 1 to the data writing/reading circuit 2. When the PGM signal given to the memory cell array 1 by the PGM signal line 4 becomes low (&#34;L&#34;) level, the power source line 5 is selectively connected to the bit line 6 into which data &#34;0&#34; is to be written, and data writing voltage V pp  is outputted. 
     The operation at the time of data writing of the conventional PROM so configured as aforementioned is as follows. 
     At first, data to be stored in the memory cell array 1 is given to the data writing/reading circuit 2 from the data bus DB, and at the same time, an address signal indicating an address of the memory cell array 1 in which the data is to be stored is given to a decoder (not shown) from the outside. 
     Responsive to the decode result of the address signal given from the outside, the word select circuit 20 selects one word line 7, thereby respective memory cells 1a of one row (column) connected to the selected word line 7 are accessed. 
     Next, when the PGM signal given by the PGM signal line 4 becomes &#34;L&#34; level, the data writing/reading circuit 2 fixes the electric potential of the bit line 6 connected to the memory cell 1a, into which data &#34;0&#34; is to be written, at the data writing voltage V pp  given from the power source line 5. While the PGM signal keeps &#34;L&#34; level, electric current is made to flow between the source and drain of each memory cell 1a, thereby data writing is performed. 
     Each operation of the data writing, in other words, electric current I pp  necessary for writing data in each row (column) of the memory cell array 1 is determined by the number of bits of &#34;0&#34; in the data to be written in each row (column) of the memory cell array 1. Therefore, when all of the bits of the data to be written in one row (column) are &#34;0&#34; the electric current I pp  becomes maximum 
     Since, usually the electric current I pp  necessary for writing one data &#34;0&#34; is 1 mA or so, when, for example, data is written in the memory cell array 1 in 16 bits unit, the maximum value of the electric current I pp  is about 16 mA. 
     On the other hand, the operation at the time of data reading is as follows. 
     At first, an address signal, indicating an address of the memory cell 1a in which data to be read from the memory cell array 1, is given to the decoder (not shown) from the outside. 
     Responsive to the decode result of the address signal given from the outside, the word select circuit 20 selects one word line 7, thereby the respective memory cells 1a of one row (column) of the memory cell array 1 connected to the selected word line 7 are accessed. 
     Next, when the DR signal given form the DR signal line 3 becomes active, the data writing/reading circuit 2 reads signals (data) stored in the respective memory cells 1a of one row (column) connected to the word line 7 selected by the word select circuit 20 and outputs it to the data bus DB. 
     In the conventional PROM, that is, in the read only memory capable of writing data, since data is written in such a way as aforementioned, when all of the bits of the data to be written are &#34;0&#34; in an operation of writing data, the electric current I pp  for writing data &#34;0&#34; becomes maximum. On the other hand, aluminum width of the power source line, which supplies the data writing voltage V pp  is required to have a width which allows the maximum value of the aforementioned data writing current I pp  and the current to be consumed increases. And when length of the data to be written in the PROM is enlarged, from 16 bits to 32 bits, for example, it is necessary to enlarge the aluminum width of the power source line correspondingly, and the current to be consumed also increases proportionally. 
     SUMMARY OF THE INVENTION 
     The present invention has been devised in such circumstances, and the objects of the invention are to provide a read only memory capable of writing data and of reducing consumed current, which can reduce the aluminum width of the power source line of the conventional read only memory capable of writing data and does not have to enlarge the aluminum width of the power source line when data length of the data to be written by one writing operation is enlarged, and to provide the method of writing/reading data. 
     The read only memory capable of writing data related to the invention is provided with judging means which judges whether or not the number of bits of the first value in data to be written in the memory unit is a half or more of a predetermined bit length, judge result storing means which stores the judge result by the judging means by corresponding it to each data, and with data inverting means which inverts values of the respective bits of data and outputs them to data writing/reading means when the number of bits of the first value of the data to be written into the memory unit is judged to be a half or more of the predetermined bit length by the judging means, and which inverts values of the respective bits of data read from the memory unit by the data writing/reading means and outputs them to the data bus, when the judge result storing means stores that the number of bits of the first value in the data to be read from the memory unit is a half or more of the the predetermined bit length. 
     In such a read only memory capable of writing data of the invention, the judging means judges that whether the number of bits of the first value in the data to be written in the memory unit is a half or more of a predetermined bit length or not, the judge result storing means stores the above judge result which is made to correspond to the respective data, and at the time of writing data the data writing/reading means writes data into the memory unit after the values of the respective bits of the data inputted from the data bus are inverted by data inverting means, when the number of bits of the first value in the data to be written is a half or more of the predetermined bit length, and at the time of reading data, the values of the respective bits of the data read from the memory unit by the data writing/reading means are inverted by the data inverting means and outputted to the data bus, when the fact that the number of bits of the first value in the data to be read is a half or more of the predetermined bit length is stored in the judge result storing means. 
     In the read only memory capable of writing data of the invention, the aforementioned judge result storing means is provided with a judge result memory unit comprising plural judge result memory cells in which the first values is written when electric current flows and the second value when electric current does not flow, and with judge result data writing/reading means which writes the second value when the judging means judges that the number of bits of the first value in data to be written in the memory unit is a half or more of a predetermined bit length, which writes the first value when the judging means judges that the number of bits of the first value in the data to be written in the memory unit is less than a half of a predetermined bit length, into the judge result memory cells corresponding to each data, and which reads a value stored in the judge result memory cell corresponding to the data to be read from the memory unit and outputs it to the data writing/reading means. 
     Further, in such the read only memory capable of writing data of the invention, at the aforementioned judge result storing means, the first value is written when electric current flows through the plural judge result memory cells of the judge result memory unit, and the second value is written when electric current does not flow, and at the time of writing data to the memory unit, the second data is written when the number of bits of the first value in data to be written to the memory unit is judged to be a half or more of a predetermined bit length, and the first value is written when the number of bits of the first value in data to be written into the memory unit is less than a half, into the judge result memory cells corresponding to the respective data by the judge result data writing/reading means, and at the time of reading data from the memory unit, a value stored in the judge result memory cell corresponding to the data to be read from the memory unit is read from the data writing/reading means. 
     Further, method of writing/reading data of read only memory capable of writing data of the invention, comprising steps for judging whether or not the number of bits of the first value in data to be written in the memory unit is a half or more of a predetermined bit length is judged, writing data after inverting the values of the respective bits thereof when the number of bits of the first value in the data to be written in the memory unit is judged to be a half or more of the predetermined bit length and writing data intact in other cases, into the designated memory cells of the memory unit, and reading data after inverting the values of the respective bits thereof read from the designated memory cells of the memory unit when the number of bits of the first value in the data is a half or more of the predetermined bit length, and is read intact in other cases. 
     Furthermore, according to such a method of writing/ reading data of a read only memory capable of writing data of the invention, at the time of writing data, the number of bits of the first value in data to be written in the memory unit is judged whether it is a half or more of a predetermined bit length or not, and written into the designated memory cells respectively, after the values of the respective bits of the data inputted form the bus are inverted when the number of bits of the first value in the data to be written is a half or more of the predetermined bit length, and without inverting the values of the respective bits in other cased, and at the time of reading the data, in the case where the number of the first value in the data is judged to be a half or more of the predetermined bit length when the data to be read out is written in the memory unit, the values of the respective bits of the data read from the designated memory cells of the memory unit are inverted and read out, and in the other case, the data is read out without being inverted. 
     In the method of writing/reading data of read only memory capable of writing data of the invention, the second value is written when the number of bits of the first value in the data to be written in the memory unit is judged to be a half or more of a predetermined bit length, and the first value is written when the number of bits of the first value in the data to be written in the memory unit is judged to be less than a half of the predetermined bit length, into the respective judge result memory cells corresponding to the respective data of the judge result memory unit comprising plural judge result memory cells into which the first value is written when electric current flows and the second value is written when electric current does not flow, corresponding to the respective data. 
     Moreover, according to such a method of writing/reading data of a read only memory capable of writing data of the invention, the second value is written when the number of bits of the first value in data to be written in the memory unit is judged to be a half or more of a predetermined bit length, and the first value is written when the number of bits of the first value in data to be written in the memory unit is judged to be less than a half, into the respective judge result memory cells corresponding to the respective data of the judge result memory unit comprising plural judge result memory cells into which the first value is written when electric current flows and the second value is written when electric current does not flow, corresponding to the respective data. 
    
    
     The above and further objects and features of the invention will more fully be apparent from the following detailed description with accompanying drawings. 
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram showing a configuration of a PROM as a conventional read only memory capable of writing data built in a general microcomputer; 
     FIG. 2 is a block diagram showing a configuration of one embodiment of a read only memory capable of writing data related to the invention; and 
     FIG. 3 is a block diagram showing a configuration example of a number of &#34;0&#34; judging circuit of a read only memory capable of writing data related to the invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     In the following, description will be made on the present invention, referring to the drawings showing the embodiments thereof. 
     FIG. 2 is a block diagram showing a configuration of one embodiment of a read only memory capable of writing data related to the invention. 
     In FIG. 2, reference numeral 1 designates memory cell array in which plural memory cells 1a are arranged in a state of matrix in row×column direction. 
     The memory cell array 1 is connected to a data bus DB through a data inverting select circuit 12 and a data writing/reading (W/R) circuit 2 to be described later. In the respective memory cells 1a, the values of the respective bits of data inputted from the data bus DB by the data writing/reading circuit 2 are written, while the values stored in the respective memory cells 1a are read to the data bus DB as the values of the respective bits. 
     The respective memory cells 1a in the memory cell array 1 are arranged, as aforementioned, in a state of matrix, the memory cells 1a in the respective rows (columns) being connected to a common word lines 7 in the respective rows (columns) direction, and the respective memory cells 1a in the respective columns (rows) direction being connected to a common bit lines 6. Accordingly, each memory cell 1a is connected to any one word line 7 and any one bit line 6. 
     Each word line is connected to a word select circuit 20, and each bit line 6 is to the data writing/reading circuit 2. 
     To the data writing/reading circuit 2, a data read signal (hereinafter, to be called a DR signal) line 3, a data writing pulse signal (hereinafter, to be called a PGM signal) line 4 and a power source line 5 are connected. 
     The power source line 5 supplies a data writing voltage V pp  to the data writing/reading circuit 2. When the DR signal given to the data writing/reading circuit 2 by the DR signal line 3 becomes active, data is read to the data writing/reading circuit 2 from the memory cell array 1. When the PGM signal given to the memory cell array 1 becomes low (&#34;L&#34;) level by the PGM signal line 4, the power source line 5 is selectively connected to the bit line 6 in which data &#34;0&#34; is to be written, and the data writing voltage V pp  is outputted. 
     Numeral 8 designates a number of &#34;0&#34; judging circuit as a judging means. The number of &#34;0&#34; judging circuit 8 is connected to the data bus DB, and the data to be written in the memory cell array 1 from the data bus DB is also to be given to the number of &#34;0&#34; judging circuit 8. When the data to be written in the memory cell array 1 is given from the data bus DB, the number of &#34;0&#34; judging circuit 8 judges whether or not the number of bits of the data &#34;0&#34; among them is a half or more of the data length. 
     To be concrete, when the number of memory cells 1a connected to the respective word lines 7 of the memory cell array 1 is 16, in other words, when the data length to be written in the memory cell array 1 in one data writing operation is 16 bits, in the case where 8 bits or more among the data are &#34;0&#34; the number of &#34;0&#34; judging circuit 8 outputs an over flow signal OVF of high (&#34;H&#34;) level to an over flow signal line 13, to be described later. The overflow signal OVF is given to the aforesaid data inverting select circuit 12 through a &#34;0&#34; signal line 131 as a number of &#34;0&#34; judge result signal (hereinafter, to be called a &#34;0&#34; signal), and at the same time, given to a monitor bit writing/reading circuit being judge result data writing/reading means through a monitor data writing pulse signal (hereinafter, to be called a MPGM signal) line 132 as a MPGM signal. 
     Reference numeral 9 designates a monitor bit cell group being judge result storing means, and numeral 10 designates the aforementioned monitor bit writing/reading circuit. 
     The monitor bit cell group 9 comprises the monitor bit cells 9a as the judge result memory cells by the same number as the word lines 7, and to the monitor bit cells 9a, the respective word lines 7 are connected through the memory cell array 1. And to each of the monitor bit cell 9a of the monitor bit cell group 9, a monitor bit line 11 is connected from the monitor bit writing/reading circuit 10. 
     Accordingly, when any one of the word lines 7 is selected by the word select circuit 20, not only the respective memory cells 1a connected to the word line 7, but also the monitor bit cell 9a connected thereto is accessed. 
     To the monitor bit writing/reading circuit 10, in the same way as the data writing/reading circuit 2, since the DR signal line 3 and the power source line 5 are connected and the MPGM signal is also given through the MPGM signal line 132, the basic operation of the circuit 10 is also same as that of the data writing/reading circuit 2 except that there is only one monitor bit line 11 corresponding to the bit line 6 of the data writing/reading circuit 2. 
     However, to the monitor bit writing/reading circuit 10, the overflow signal OVF is given as the MPGM signal through the overflow signal line 13 and the MPGM signal line 132. Therefore, the monitor bit writing/reading circuit 10 writes data &#34;1&#34; when the MPGM signal is &#34;H&#34; level, and data &#34;0&#34; when &#34;L&#34; level. 
     To be concrete, when the MPGM signal is &#34;L&#34; level, by outputting the data writing voltage V pp  being supplied from the power source line 5 to the monitor bit line 11, the monitor bit writing/reading circuit 10 writes data &#34;0&#34; in the monitor bit cell 9a connected to the word line 7 selected by the word select circuit 20. On the other hand, when the MPGM signal is &#34;H&#34; level, by not outputting the data writing voltage V pp  supplied from the power source line 5 to the monitor bit line 11, the monitor bit writing/reading circuit 10 writes data &#34;1&#34; to the monitor bit cell 9a connected to the word line 7 selected by the word select circuit 20. 
     Meanwhile, at the time of reading data from the memory cell array 1, in the same way as the data writing/reading circuit 2, the monitor bit writing/reading circuit 10, by being given the DR signal through the DR signal line 3, reads data stored in the monitor bit cell 9a connected to the selected word line 7 and outputs it to the monitor bit signal line 14 as a monitor bit signal (hereinafter, to be called an MB signal) to be given to the data inverting select circuit 12. 
     FIG. 3 is a block diagram showing a configuration example of the number of &#34;0&#34; judging circuit 8. 
     In FIG. 3, reference character 8a designates a shift register, 8b a two-input OR gate, and 8c an up counter. 
     To the shift register 8a, the data bus DB is connected, and data to be stored in the memory cell array 1 is inputted. Clock CLK is given to the shift register 8a, and the register 8a shifts data inputted from the data bus DB bit by bit in synchronism with the clock CLK from the left side to the right side in FIG. 3 and outputs the extreme right side bit so as to input it to one input terminal of an OR gate 8b. 
     To the other input terminal of the OR gate 8b, clock CLK is inputted. Therefore when the data outputted from the shift register 8a is &#34;0&#34;, the clock CLK is outputted intact as the output of the OR gate 8b, and when the data outputted from the sift register 8a is &#34;1&#34;, the output of the OR gate 8b is fixed at &#34;H&#34; level. 
     The up counter 8c is so constructed that it inputs the output of the aforementioned OR gate 8b to count a rising edge of the clock CLK. Accordingly, the up outer 8c is to count the number of bits of &#34;0&#34; in the data held in the shift register 8a. And when the up counter 8c counts a half number (8 bits when the data length is 16 bits) of data length stored in the memory cell array 1, it overflows to output the overflow signal OVF of &#34;H&#34; level. The overflow signal OVF is outputted to the overflow signal line 13, and it is given to the data inverting select circuit 12 from the &#34;0&#34; signal line 131 as the &#34;0&#34; signal, and given to the monitor bit writing/reading circuit 10 from the MPGM signal line 132 as the MPGM signal. 
     Explanation will be made on the operation of the PROM of the invention so constructed as in the above will be made in the following. 
     The operation at the time of writing data is as follows. 
     At first, one row (column) of data to be stored in the memory cell array 1 is given to the data inverting select circuit 12 and number of &#34;0&#34; judging circuit 8. At this time, an address signal, which indicates the address of the memory cell array 12 in which the data is to be stored, is given to the decoder (not shown) from the outside. 
     At the number of &#34;0&#34; judging circuit 8, number of bits of &#34;0&#34; in the data given from the data bus DB is judged whether it is a half or more of the data length or not in such a manner as aforementioned. 
     When the data length is assumed to be 16 bits and the number of bits of &#34;0&#34; is 8 or more, for example, the overflow signal OVF of &#34;H&#34; level is outputted to the overflow signal line 13 from the number of &#34;0&#34; judging circuit 8, outputted to the data inverting select circuit 12 from the &#34;0&#34; signal line 131 as the &#34;0&#34; signal, and to the monitor bit writing/reading circuit 10 from the MPGM signal line 132 as the MPGM signal. 
     At the data inverting select circuit 12, when the &#34;0&#34; signal given from the &#34;0&#34; signal line 131 is &#34;H&#34; level, the values of the respective bits of the data inputted from the data bus DB are inverted. For example, when the data inputted form the data bus DB is &#34;00h (h designates hexadecimal number)&#34;, it is made &#34;FFh&#34;. The data inverting select circuit 12 sends the data obtained by inverting the values of the respective bits in such a way to the data writing/reading circuit 2. 
     On the other hand, the word select circuit 20 selects one word line 7 responsive to a decode result of an address given from the outside, thereby the respective memory cells la of one row (column) of the memory cell array 1 connected to the word line 7 are selected. 
     Next, when the PGM signal given to the data writing/reading circuit 2 by the PGM signal line 4 becomes &#34;L&#34; level, in the same way as in the conventional example, the data writing/reading circuit 2 fixes, as aforementioned, the potential of the bit line 6 connected to a memory cell 1a in which &#34;0&#34; is written in data sent from the data inverting select circuit 12 at the data writing voltage V pp  given from the power source line 5. While the PGM signal keeps &#34;L&#34; level, data is written by making electric current flow between the source and drain of each memory cell 1a through the bit line 6. 
     In addition, it is needless to say that the data to be written in the memory cell array 1 by the data writing/reading circuit 2 in such a way as abovementioned is the data obtained by inverting the values of the respective bits of the original data by the data inverting select circuit 12. 
     At the same time of the writing data in the aforementioned memory cell array 1, a monitor cell 9a of the monitor bit cell group 9 connected to the word line 7 selected by the word select circuit 20 is accessed, and the MPGM signal given to the monitor bit writing/reading circuit 10 from the MPGM signal line 132 becomes &#34;H&#34; level as well. Accordingly, to the monitor bit cell 9a connected to the selected word line 7, &#34;1&#34; is written. 
     Next, a case where the number of bits of &#34;0&#34; is less than 8 will be explained, when the data length to be stored in the memory cell array 1 is assumed, for example, to be 16 bits. 
     In this case, the overflow signal OVF of &#34;L&#34; level is outputted to the overflow signal line 13 from the number of &#34;0&#34; judging circuit 8, and given to the data inverting select circuit 12 from the &#34;0&#34; signal line 131 as the &#34;0&#34; signal, and given to the monitor bit writing/reading circuit 10 from the MPGM signal line 132 as the MPGM signal, respectively. 
     At the data inverting select circuit 12, when the &#34;0&#34; signal given from the &#34;0&#34; signal line 131 is &#34;H&#34; level, it sends the data inputted from the data bus DB to the data writing/reading circuit 2 without inverting the values of the respective bits. 
     Since the operation that the data sent to the data writing/reading circuit 2 from the data inverting select circuit 12 is written,in the memory cell array 1 is same as in the aforementioned case, the explanation thereof will be omitted. 
     Meanwhile, at the same time of the writing of data in the aforementioned memory cell array 1, a monitor bit cell 9a of the monitor bit cell group 9 connected to the word line 7 selected by the word select circuit 20 is accessed, and the MPGM signal given to the monitor bit writing/reading circuit 10 from the MPGM signal line 132 becomes &#34;L&#34; level. Accordingly, to the monitor bit cell 9a connected to the selected word line, &#34;0&#34; is written. 
     On the other hand, the operation at the time of reading data is as follows. 
     At first, an address signal, which indicates the address of the memory cell 1a in which the data to be read from the memory cell array 1 is given to a decoder (not shown) from the outside. 
     The word select circuit 20 selects one word line 7 responsive to the decode result given from the outside, thereby the respective memory cells 1a of one row (column) of the memory cell array 1 connected to the selected word line 7 are accessed. 
     Next, when the DR signal given from the DR signal line 3 becomes active, the data writing/reading circuit 2 reads a signal (data) stored in the respective memory cells 1a of the row (column) connected to the word line 7 selected by the word select circuit 20 and outputs it to the data inverting select circuit 12. 
     On the other hand, the monitor bit cell 9a of the monitor bit group 9 connected to the word line 7 selected by the word select circuit 20 is also accessed. At the same time, since the DR signal given to the monitor bit writing/reading circuit 10 through the DR signal line 3 also becomes active, the value stored in the monitor bit cell 9a of the monitor bit cell group 9 connected to the word line 7 selected by the word select circuit 20 is read by the monitor bit writing/reading circuit 10. 
     In such a way, when the value read to the monitor writing/reading circuit 10 is &#34;0&#34;, it means that the data read into the data writing/reading circuit 2 from the memory cell array 1 was not inverted at the time of being stored in the memory cell array 1. In this case, the data read to the data writing/reading circuit 2 from the memory cell array 1 is outputted intact to the data bus DB without being inverted at the data inverting select circuit 12. 
     But, when the value read to the monitor bit writing/reading circuit 10 is &#34;1&#34;, it means that the data read into the data writing/reading circuit 2 from the memory cell array 1 was inverted at the time of being stored in the memory cell array 1. In this case, the data read into the data writing/reading circuit 2 is outputted to the data bus DB after being inverted by the data inverting select circuit 12. 
     As in the abovementioned embodiment, according to the read only memory capable of writing data and the data and the method of writing/reading data of the invention, the maximum value of the electric current I pp  required for the case where electric current is made to flow to a memory cell at the time of writing &#34;0&#34; of a binary number in the memory cell of a PROM is same as in the case where the number of a half bits of the data length of the data to be written in the memory cell array is &#34;038 . 
     To be concrete, when the data length is 16 bits and 8 bits among them are &#34;0&#34;, eight bits of &#34;0&#34; are written into the memory cell array of the PROM after the data is inverted, but &#34;1&#34; is written into the monitor bit cell group, therefore eight bits of &#34;0&#34; are written as a whole. When the data length is, for example, 16 bits, and 7 bits among them are &#34;0&#34;, seven bits of &#34;0&#34; are written into the memory cell array of the PROM, the data not being inverted at the time. However, since &#34;0&#34; is written into the monitor bit cell group, eight bits of &#34;0&#34;s are written as a whole. Further, when the data length is, for example, 16 bits, and 9 bits among them are &#34;0&#34;, the data is inverted and seven bits of &#34;0&#34; are written into the memory cell array of the PROM. But since &#34;1&#34; is written into the monitor bit cell group, seven bits of &#34;0&#34;s are written as a whole. 
     Accordingly, when the data length remains as it is, the electric current consumed at the time of writing data into the PROM is reduced, and also the aluminum width of the power source line supplying the data writing voltage can be reduced. And when the data length is enlarged, the electric current consumed at the writing of the data to the PROM can be suppressed to almost the same degree after enlarging the data, and it becomes unnecessary to enlarge the aluminum width of the power source line supplying the data writing voltage. 
     In addition, when the data length is an odd number, for example, when the data length is 17 bits and 9 bits among them are &#34;0&#34;, the data is inverted and eight bits of &#34;0&#34; are written into the memory cell array of the PROM, but &#34;1&#34; is written into the monitor bit cell group, therefore, eight bits of &#34;0&#34; are written as a whole. And, in the same way, for example, when the data length is 17 bits and 8 bits among them are &#34;0&#34;, the data is not inverted and eight bits of &#34;0&#34; are written into the memory cell array of the PROM. But since &#34;0&#34; is written into the monitor bit cell group, nine bits of &#34;0&#34; are written as a whole. 
     Accordingly, when the data length is an odd number, &#34;0&#34; of a half number of bits of the value obtained by adding 1 to the data length as a maximum value is to be written as a whole, and the above effect is almost same as the case where the aforementioned data length is an even number. 
     In addition, in the abovementioned embodiment, electric current is made to flow into the memory cell in which &#34;0&#34; of a binary number is written, however, it is needless to say that the present invention can be applied to such a PROM that electric current is made to flow into the memory cell in which &#34;1&#34; is written, and in that case, it is sufficient to invert the data and judge whether to write it into the memory cell array corresponding to the fact that whether the number of memory cells into which &#34;1&#34; is written is a half or more of the data length or not. 
     As abovementioned, according to the read only memory capable of writing data and the method of writing/reading data of the invention, at the time of writing, for example, &#34;0&#34; of a binary number to a memory cell of a PROM, when it is necessary to make electric current flow into the memory cell, the maximum value of the data writing current I pp  is same as in the case where a half number of bits of the length of the data to be written in the memory cell array in the conventional PROM are &#34;0&#34;. 
     Accordingly, when the present invention is applied, electric current consumed at the time of writing of the data to the memory cell array is reduced when the data length remains as it is, and also the aluminum width of the power source line supplying the data writing voltage can be reduced. And when the data length is enlarged, it is possible to suppress the electric current consumed at the writing of the data into the memory cell array to almost the same degree after the data is enlarged, and it is unnecessary to enlarge the aluminum width of the power source line supplying the data writing voltage. 
     As this invention may be embodied in several forms without departing from the spirit of essential characteristics thereof, the present embodiment is therefore illustrative and not restrictive, since the scope of the invention is defined by the appended claims rather than by the description preceding them, and all changes that fall within the metes and bounds of the claims, or equivalence of such metes and bounds thereof are therefore intended to be embraced by the claims.