A mapping between Object Oriented Design and Hardware Description Languages
Object Oriented approach of analysis, design and implementation has proved its importance in software development in terms of its Abstraction, Encapsulation, Polymorphism, Concurrency and Reusability advantages. Also Object Oriented designs are found to be easy to be tested. So they reduce the effort and resources consumed for testing these systems. All these features made the approach very popular in general software development market.
But here a question arises, whether we can use the same Object Oriented concept in a hardware design. (Here the hardware design mainly focuses on the VLSI chip designs.) We see around us that these approaches were not so readily accepted in the case of hardware systems as compared to the software systems design.
Can we answer why Object Oriented concepts are not so popular in the H/W industry as they are in S/W?
Let's try to find out the answer:
- One reason may be that the hardware generally works on Data-Flow techniques. Whenever a signal is available, it is processed and passed as per the functionality of the system. Due to this a concept of Object may be confusing here.
- Another reason may be that the generally used Hardware Description Languages (HDLs), VHDL and Verilog, are not object oriented but they are a combination of Sequential, Concurrent and Net-list Languages. So they cannot directly implement the object oriented designs.
- Working of hardware on data flow techniques makes structural approach of designing more acceptable for general hardware designs where we try to slice the system in terms of data and functionality of the system and subsystems.
Why do we need a mapping between OOL and HDL?
Hardware is basically a (logically) restricted combination of some conducting components, controlled with the principles of Physics and Electronic Magnetic Theory (EMT). As told earlier, the generally used HDLs are not object-oriented languages and hence they cannot directly implement an object-oriented hardware design. For this, we need a mapping between the Object Oriented Design and an HDL.
Let's try to analyze how the Object Oriented concepts may be mapped with HDLs. For this we try to analyze how the concepts of Object Oriented Approach are meant in hardware description languages. The object-oriented approach gives us the advantages of Abstraction, Encapsulation, Polymorphism, Reusability and Concurrency features. I will now map these features to HDL's. For this I have taken VHDL as a reference for HDL.
- Abstraction and Encapsulation: Abstraction is hiding the internal details of the component from other components in a system. The different components may access the services of other components but none can see how the component processes these services and also cannot interfere in their internal working. The concept of abstraction in object-oriented languages provide us to have
Private type of data objects in our system or code. This concept can also be used in hardware systems which itself is a combination of different subsystems and components. This facility is provided in hardware description languages too. In HDL, we define different entities and use them as components in different system architectures.
- Here the
public data object will represent the ports of the system.
protected data objects of the system will lie on the ports of the subsystems and components used in its architecture.
private data objects will be the internal signals defined in the system architecture.
- Reusability: In the hardware systems, the concept of reusability may stand for basically two different meanings:
- One: To use a single component at different places.
- Two: To use copies of the component at different places.
For the first one, i.e. to use the single component at different places, we can use a system like the one shown below (here 'IW' is the width of Input port and 'OW' is the width of output port of the reusable component):
The I0 to I3 and O0 to O3 are the input and output lines of the application or the system that needs access to the reusable component. This system can easily be simulated in any HDL using MUX, DMUX and Reusable components in library.
For the second case i.e. to use the copies of a system at different places, we can use this system as a component with suitable port mapping in the structural design architecture of the other system that needs access to it. In the same architecture body, if we need multiple interconnected copies of the same system, we can also use "Generate" command as in VHDL. This is basically reusing an entity to generate multiple components to be used in the design. In any object-oriented language, it is analogous to defining multiple objects of a class and then using their functionalities individually. Each of these objects will have its own identity and state but the same behavior for same conditions. Similarly in HDLs, different generated component's instantiations have their own identity and states but all the components have the same behavior as that of their base identity from which they are generated.
- Polymorphism: Another feature of the object-oriented concept is to provide the facility of function overloading in terms of polymorphism. In fact, polymorphism may be defined as the capability to exist in more than one form. A similar concept may also be implemented in VHDL using the subprogram overloading. In this we may have two or more programs with same names. For example:
function COUNT (ORANGES: INTEGER) return INTEGER;
function COUNT (APPLES:BIT) return INTEGER;
Here the function
COUNT is said to be overloaded. When a call is made to either of them, it is possible to identify the exact function to which the call is made from the type of actuals passed because they have different parameter types.
- Concurrency: Concurrency of the functions or modules or processes. Object Oriented designs allow independent processes to run simultaneously in parallel. In fact in any computer system, we mainly have two types of parallelism:
- One: Multiprocessing system parallelism.
- Second: Multithread system parallelism.
Apart from that we also have another concept of dataflow tracks or dataflow computers. These points give the idea of parallelism in computer systems. But for the mapping in OOLs and HDLs, we need to discuss parallelism in the programming environment. There are two types of programming environment parallelism:
- One: Implicit Parallelism, where we use the conventional languages like C, Fortran, LISP or Pascal to write the source code program. The sequential codes of the source program are then translated into parallel object code using a parallelizing compiler.
- Two: Explicit Parallelism, where more efforts applied by the programmer are required to develop a source program using the parallel dialects of programming languages. This in fact is the main concern for concurrency to be discussed in this study paper. Parallelism is explicitly specified in user programs. Now the compiler needs to preserve parallelism and wherever possible, assign the target machine resources to the processes. In Object Oriented system designs and language implementation codes, we define the concurrent states and state transition of individual objects and subsystems. Also in HDLs, we can easily implement the states of these subsystems using concurrent "Process" statements. The statements under the "Process" block execute sequentially but the "Process" statement itself is concurrent. The multiple threads may be implemented in multiple process blocks, which will finally be executed in parallel.
Importance of Mapping: What do we get by this analysis?
We can use this analysis to answer the following summarized queries and implement those answer in a producible product format:
- The scenario of hardware technology these days is becoming more and more based on simulators for their better understanding and experiments while advancements. Can we design a format or a concept where we can use object-oriented languages to develop a simulator of the system if its HDL implementation is given to us?
- With this analysis, can we categorize the hardware systems and then can we find out some category of hardware where the OO concepts give better designs in lesser efforts?
- Can we design a format or a concept where we can develop an HDL code for a system from the Object-Oriented Language code of its simulator?
- Can we produce a system or a format or some concept with which we may be able to implement an object-oriented design of some hardware system into its HDL code and vise versa?