Software-Hardware Codesign

In order for software to be able to communicate with hardware, part of the interface needs to be abstracted to account for the untimed-timed boundary. Besides using SystemC to model software/testbench, CvSDL provides two basic support mechanisms to do so in addition to user-defined callbacks that can be made sensitive to signal changes or simulator events. One mechanism allows direct access to nets and variables in hardware models and the other is to use the function void TCvModule::SetRequest(void*). Note that the first mechanism may incur lots of thread switching.

The first mechanism abstracts the layers from memory and I/O read and write assembly instructions, such as out al, 3ch, to the interface of whatever hardware module intended to be driven by software. For example you may create a C++ macro that takes parameters and sets a value to a net at the interface of the module. Read operations require callers to block until valid data are returned.

Using these hardware-abstraction macros you can start building real device drivers as soon as an executable specification on the hardware side is ready. Interrupt handlers need to be callbacks that are sensitive to edges or levels of hardware interrupt signals.

The second mechanism improves the software-hardware interface performance, by sending I/O requests as packets just as done in typical operating systems. It requires device drivers to be modeled as named CvSDL processes. You can create empty modules for device drivers in Verilog with correct (hardware) interfaces, and fill them with driver functions in C++.

To send a request packet to a device driver, software needs to get the pointer of the driver process and then call a process member function with the packet pointer:

TCvProcess *ptr = sim->GetProcess(“my_driver”);
ptr->SetRequest(my_packet);

The driver process needs to call void* TCvModule::GetRequest(), which will block if there is no request packet pending; otherwise it will return the first packet found in its internal FIFO. Driver processes should include a GetRequest() call in its request-polling loop. The device side can support access that are programmed I/O, interrupt driven , DMA with interrupts, or whatever required.

If you need to model hard realtime systems, you need CPU models with instruction clock counts and interrupts overhead accurately modeled.


Trademarks and registered trademarks are property of the respective owners.
CvSDL is a trademark of Tenko Technologies Inc.
Copyright © 2005 Tenko Technologies Inc. All rights reserved. Last modified on 08/14/05.