The field of the invention is data processing, or, more specifically, methods, apparatus, and products for reduced logic conversion of binary integers to binary coded decimals.
The development of the EDVAC computer system of 1948 is often cited as the beginning of the computer era. Since that time, computer systems have evolved into extremely complicated devices. Today's computers are much more sophisticated than early systems such as the EDVAC. Computer systems typically include a combination of hardware and software components, application programs, operating systems, processors, buses, memory, input/output devices, and so on. As advances in semiconductor processing and computer architecture push the performance of the computer higher and higher, more sophisticated computer software has evolved to take advantage of the higher performance of the hardware, resulting in computer systems today that are much more powerful than just a few years ago.
In programming languages such as COBOL, numbers may be encoded in various formats, such as hexadecimal, binary integers, and binary coded decimal. Some operations require numbers to be converted from one format to another. As an example, a binary integer may be converted to binary coded decimal for display in a human-readable format.
The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular descriptions of exemplary embodiments of the invention as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts of exemplary embodiments of the invention.
In programming languages such as COBOL, numbers may be encoded in various formats, such as hexadecimal, binary integers, and binary coded decimal. Some operations require numbers to be converted from one format to another. As an example, a binary integer may be converted to binary coded decimal for display in a human-readable format.
To this end, exemplary methods, apparatus, and products for reduced logic conversion of binary integers to binary coded decimals in accordance with the present invention are described with reference to the accompanying drawings, beginning with
As shown in
In order to convert the input 102 binary integer to a binary coded decimal output 104, an intermediate value 106 is generated. The intermediate value 106 includes multiple digits each equal to zero. Each digit in the intermediate value 106 is encoded using a plurality of bits and using an intermediate format to be described in further detail below. As shown, the logic flow of
A bit from the input 102 is shifted into the intermediate value 106 and the intermediate value 106 is doubled for each bit in the input 102 until each bit of the input 102 has been shifted into the intermediate value 106 and a doubling operation has been performed. Each digit of the resulting intermediate value 106 is then converted to a corresponding binary coded decimal digit of the output 104.
Existing solutions for converting binary integers to binary coded decimal values use an approach similar to that of
The third column of the table 200 shows the encoding of each digit using the prior intermediate format of existing solutions. In the prior intermediate format, each digit is encode using six bits. The five most significant bits of the prior intermediate format each correspond to a particular even numbered weight, from eight to zero in descending order. The sixth most significant bit corresponds to a weight of one. In order to calculate a particular digit, the weights having their corresponding bit set to one are added together. As an example, in order to calculate the digit three, the bits for weights two and one are set. As another example, in order to calculate the digit seven, the bits for weights six and one are set. Using the prior intermediate format, at least one of the five most significant bits corresponding to the even umbered weights must be set to one. Accordingly, the encoding for the digit zero has the bit for the zero weight set and the encoding for the digit one has the zero and one weights set.
The fourth column of the table 200 shows the doubled encoding of the corresponding digit using the prior intermediate format. For example, for the digit three, the fourth column shows the encoding for the doubled value of six. Though not shown, the doubling of digits five through nine would result in a carry bit that would be added into an adjacent more significant digit. As is clear from the table 200, the value of each bit of a doubled digit for weights eight through two may be expressed by selecting one of a pair of bit values from the original encoding under the prior intermediate format and selected based on the value of the bit for the one weight. This is shown using the multiplexer 300 of
As an example, for any doubled digit, the bit value for the eight weight may be selected as either the bit value of the eight weight or the four weight from the undoubled digit, selected based on the bit value of the one weight. In other words, according to
The multiplexer 300 of
In contrast to the existing solutions shown in
In further contrast to the existing solutions shown in
Reduced logic conversion of binary integers to binary coded decimals in accordance with the present application is generally implemented with computers, that is, with automated computing machinery. For further explanation, therefore,
Stored in RAM 704 is an operating system 710. Operating systems useful in computers configured for reduced logic conversion of binary integers to binary coded decimals according to certain embodiments include UNIX™, Linux™, Microsoft Windows™, and others as will occur to those of skill in the art. The operating system 710 in the example of
The computer 700 of
The example computer 700 of
The exemplary computer 700 of
For further explanation,
The method of
The method of
The method of
For example, each digit of the doubled intermediate value 106 may correspond to a plurality of doubler logics 500, with each doubler logic 500 configured to calculate a bit value for the weights eight through two of the doubled digit. Accordingly, each doubler logic 500 accepts, as input, a pair of bit values from the undoubled digit used to calculate a particular bit value of the doubled digit. Each doubler logic 500 also accepts, as input, from the undoubled digit, the bit values for the one weight and inverse one weight.
In some embodiments, doubling 806 the intermediate value 106 also includes calculating 809, for each digit of the intermediate value 106, a carry bit and an inverse carry bit (e.g., using carrier logic 600 of
At step 810, it is determined if there are bits of the input binary integer (e.g., the input 102) yet to be shifted in. If there are, the process returns to shifting 804 a bit of the input binary integer into the intermediate value 804. Otherwise, once all bits are shifter in, the intermediate value 106 is converted 812 to a binary encoded decimal output 104. That is, each digit of the intermediate value 106 encoded using the intermediate format is converted to a corresponding binary encoded decimal. The output 104 may then be acted upon, for example, to display the output 104 or perform other operations.
In view of the explanations set forth above, readers will recognize that the benefits of reduced logic conversion of binary integers to binary coded decimals according to embodiments of the present invention include improved performance of a computing system by reducing the number of logic gates required to convert a binary integer to a binary coded decimal, increasing the number of doubling stages performed per cycle and improving performance.
Exemplary embodiments of the present invention are described largely in the context of a fully functional computer system for reduced logic conversion of binary integers to binary coded decimals. Readers of skill in the art will recognize, however, that the present invention also may be embodied in a computer program product disposed upon computer readable storage media for use with any suitable data processing system. Such computer readable storage media may be any storage medium for machine-readable information, including magnetic media, optical media, or other suitable media. Examples of such media include magnetic disks in hard drives or diskettes, compact disks for optical drives, magnetic tape, and others as will occur to those of skill in the art. Persons skilled in the art will immediately recognize that any computer system having suitable programming means will be capable of executing the steps of the method of the invention as embodied in a computer program product. Persons skilled in the art will recognize also that, although some of the exemplary embodiments described in this specification are oriented to software installed and executing on computer hardware, nevertheless, alternative embodiments implemented as firmware or as hardware are well within the scope of the present invention.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
It will be understood from the foregoing description that modifications and changes may be made in various embodiments of the present invention without departing from its true spirit. The descriptions in this specification are for purposes of illustration only and are not to be construed in a limiting sense. The scope of the present invention is limited only by the language of the following claims.