SystemC_8-1.ppt

advertisement
Methodology for HW/SW
Co-verification in SystemC
Part of
HW/SW Codesign of Embedded
Systems Course (CE 40-226)
Winter-Spring 2001
Codesign of Embedded Systems
1
Topics





Introduction
Design Flow
Processor Models
Implementation: 8051
Conclusion
Reference:
L. Semeria & A. Ghosh, “Methodology for Hardware/Software Co-Verification in
C/C++”, in ASP-DAC 2000
Winter-Spring 2001
Codesign of Embedded Systems
2
Methodology for HW/SW
Co-verification in SystemC
Introduction
Winter-Spring 2001
Codesign of Embedded Systems
3
Introduction




Shrinking device sizes => all digital
components on a single chip
Software is traditionally fully tested after
hardware is fabricated => long TTM
Integrating HW and SW earlier in the design
cycle => better TTM
Co-simulation involves

Simulating a processor model along with custom
hw (usually described in HDL)
Winter-Spring 2001
Codesign of Embedded Systems
4
Introduction (cont’d)

Heterogeneous co-simulation
environments (C-VHDL or C-Verilog)


RPC or another form of inter-process
communication between HW and SW
simulators
High overhead due to high data
transmission between the simulators
Winter-Spring 2001
Codesign of Embedded Systems
5
Introduction (cont’d)

Recently HW synthesis techniques from
C/C++ are more investigated

Eliminates C to HDL translation for synthesis =>
higher productivity



Reduces translation time
Eliminated bugs introduced during this translation
Easier verification by
 re-using testbenches developed during system
validation phase

enabling hw/sw co-verification and performance
estimation at very early stages of design
Winter-Spring 2001
Codesign of Embedded Systems
6
Introduction (cont’d)

In this paper, authors present


How hw/sw co-verification is performed in
a C/C++ based environment
hw and sw are both described in C++
(SystemC)

Other C/C++ based approaches: PTOLEMY, and
CoWare N2C,
Winter-Spring 2001
Codesign of Embedded Systems
7
Methodology for HW/SW
Co-verification in SystemC
Design Flow
Winter-Spring 2001
Codesign of Embedded Systems
8
Design Flow
Functional Specification
of the system
Mapping
Architectural Specification
Refinement of Individual
hw and sw blocks
Synthesis for hw blocks
Compilation for sw blocks
Winter-Spring 2001
Codesign of Embedded Systems
9
Methodology for HW/SW
Co-verification in SystemC
Processor Models
Winter-Spring 2001
Codesign of Embedded Systems
10
Processor Models


Bus Functional Model (BFM)
Instruction-Set Simulator (ISS)
Winter-Spring 2001
Codesign of Embedded Systems
11
Bus Functional Model (BFM)

Encapsulates the bus functionality of a
processor



Can execute bus transactions on the processor bus
(with cycle accuracy)
Cannot execute any instructions
Hence,

BFM is an abstract model of processor that can be
used to verify how a processor interacts with its
peripherals
Winter-Spring 2001
Codesign of Embedded Systems
12
Bus Functional Model (cont’d)
At early stages of the design
C/C++
SW
SW
SW
BFM
HW
HW
HW
In the later stages of the design
Assembly
Winter-Spring 2001
ISS
SW
SW
SW
BFM
Codesign of Embedded Systems
HW
HW
HW
13
Design of the BFM

Is a SystemC module


Ports of the module correspond to the pins of the
processor
Methods of the module provide a PI (programming
interface) to the software/ISS


They depend on the type of communication between hw
and sw
BFM functionality is modeled as a set of
concurrent FSMs
Winter-Spring 2001
Codesign of Embedded Systems
14
Memory-mapped IO


Peripherals are located on a portion of CPU
address space
BFM provided methods




void bfm_read_mem(sc_address, sc_data *, int)
void bfm_write_mem(sc_address, sc_data, int)
SW (without ISS) calls these functions to
access hw
When using ISS, SW calls device drivers.

Device drivers are run in the ISS and at proper
time call these functions
Winter-Spring 2001
Codesign of Embedded Systems
15
Interrupt-driven IO

An interrupt controller is implemented in BFM



In case of an interrupt, the corresponding ISR
is called
ISRs are registered by these BFM methods


It is made sensitive to the CPU interrupt lines
void bfm_register_handler(sc_interrupt,
void (*handler)(sc_interrupt))
Interrupts may be masked/change behavior
using configuration ports
Winter-Spring 2001
Codesign of Embedded Systems
16
Configuration ports,
Access to internal registers

CPUs often have configuration ports for





BFM methods to access these registers



Multiple modes of operation
Multiple timers/serial modes
Masked interrupts
etc
void bfm_read_reg(sc_register, sc_data*, int nb)
void vfm_write_reg(sc_register, sc_data, int nb)
BFM usually doesn’t model general-purpose
registers of the CPU
Winter-Spring 2001
Codesign of Embedded Systems
17
Timers and Serial Ports


Normally, controllers for these timers and
serial ports are implemented within BFM
They are configured using configuration ports
and registers


Previously mentioned functions are used
They may issue interrupts to the CPU
Winter-Spring 2001
Codesign of Embedded Systems
18
Performance Estimation
Functions

BFM keeps track of bus transactions



Can report number of clock cycles spent for each
bus transaction
Reporting can be taken after each transaction or
at the end of simulation
Tracking is enabled using


void bfm_enable_tracing(int level)
level is used to define multiple levels of tracking

Even debug information can be produced by the BFM
Winter-Spring 2001
Codesign of Embedded Systems
19
HW/SW Synchronization

Normal BFM methods are blocking



A flag can be set in the BFM to make SW
execute in parallel with HW


SW execution is suspended until the bus
transaction is done
This essentially serialized SW and HW execution
i.e. BFM methods return immediately
SW can wait for a specific number of clock
cycles by calling

void bfm_idel_cycle(int)
Winter-Spring 2001
Codesign of Embedded Systems
20
Processor Model


Bus Functional Model (BFM)
Instruction-Set Simulator (ISS)
Winter-Spring 2001
Codesign of Embedded Systems
21
Instruction-Set Simulator
Winter-Spring 2001
Codesign of Embedded Systems
22
Methodology for HW/SW
Co-verification in SystemC
Implementation: 8051
Winter-Spring 2001
Codesign of Embedded Systems
23
What we learned today
Winter-Spring 2001
Codesign of Embedded Systems
24
Complementary notes:
Assignments

Take Assignment 8

Due Date: Saturday, Khordad 12th
Winter-Spring 2001
Codesign of Embedded Systems
25
Download