To demonstrate a ALU+barrel shifter module and execution using SystemC (version 3.0.0) from Accellera and Gtkwave, an open-source wave/timing diagram viewer.
SystemC is a library that may be included in C++ code, consisting of many classes and macros for system development. These classes allow one to design, model, and simulate a system prototype using techniques similar to SystemVerilog and VHDL, but with the programmability of a C-based language. It is important to become familiar with the coding paradigm, and obtain an understanding of how it can be used for various different hardware/software designs in SoC modeling.
Design an Integer Arithmetic-based ALU using SystemC. The ALU may add (A+B) or subtract (A-B) two numbers, where input B is connected to a barrel shifter. Thus if enabled, input B will first be shifted to the left or right (l_r) by shift_amt before being transferred to the ALU's B input. Figure 2 outlines the ALU architecture and respective control signals of the system, whereas Table I dictates specifications of the unit's control signal functionality.
| ALU | Barrel Shifter | |||
|---|---|---|---|---|
| OpCode | Functionality | enable | l_r | Functionality |
| 0 | Subtract | 0 | X | Pass Data through (shifting disabled) |
| 1 | Addition | 1 | 0 | Shift left by shift_amt |
| 1 | 1 | Shift right by shift_amt |
There are many ways to implement the design of Figure 2. However, it is important that the barrel shift occur before the ALUs computation. Thus the two components may require different sensitivity lists, or may execute in a pipelined fashion to guarantee that the barrel shifter executes in the cycle prior to the ALU.
Not all the files are uploaded. The header files and executable is. To run, enter ./ALUbarrel.x in the terminal of the parent folder.
Figure 1: The terminal readout from SystemC executable and its corresponding results on the timing diagram
