Hardware / Software Co-Simulation I
Introduction to HW/SW Partitioning in SystemC and Concurrent Process Models
Software often follows the “90/10 rule”: the theory that 90% of the running time of a given program is consumed in only 10% of that program’s code. In order to minimize the running time of a program following the “90/10 rule”, digital systems designers may partition that expensive 10% of the software into hardware. To enact this hardware/software partitioning, a developer would usually need to design and compile the software portion of the partition using a separate software programming language such as C or C++; and then, design and synthesize the hardware portion of the partition using a hardware description language such as VHDL or Verilog. The advantage of SystemC is that it allows hardware/software co-design and co-simulation in one environment.
"The concurrent process model is a model that allows us to describe the functionality of a system in terms of two or more concurrently executing subtasks. Concurrent process models are also useful when describing systems that are inherently multitasking. In order to describe a concurrent process model, the use of a language (such as SystemC) that captures the concurrent process model is necessary. Implementation is a mapping of a system's functionality, capture using a computational model (or models) onto hardware processors." (Paraphrased from the ESD textbook" In the interest of hardware/software partitioning, SystemC allows the designer to create a hardware/software implementation of a digital system and then perform hardware/software co-simulation.
1. Download: hello.cpp. Add the file to a new project and simulate the design. Modify the code so that "hi there" is printed a total of 10 times without extending the SystemC simulation time. Name your modified file "hello2.cpp".
2. Download: mult2_sw.cpp. Add the file to a new project. Modify the code so that both modules interact concurrently by using a handshake protocol. Simulate the design and verify for correctness. Name your modified file "mult2_sw2.cpp".
3. Modify the code to from the previous problem "mult2_sw2.cpp" so that the multiplication in the 2nd module is done using a hardware implementation (such as shift, masking, etc.). Name your modified file "mult2_hw.cpp".
4. In a separate project, design two concurrent modules that determines if a number is odd. First write a SW / SW' implementation such as you did in problem #2. Save this file as "odd_sw.cpp". Then, modify your code into a hardware / software implementation as you did in problem #3. ( Find the odd number through bit manipulations such as shifting, masking, rotating, etc.) Save this file as "odd_hw.cpp". Simulate your designs and verify for correctness.