logo资料库

SystemC From the Ground Up (Second Edition).pdf

第1页 / 共291页
第2页 / 共291页
第3页 / 共291页
第4页 / 共291页
第5页 / 共291页
第6页 / 共291页
第7页 / 共291页
第8页 / 共291页
资料共291页,剩余部分请下载后查看
0387699570
SystemC: From the Ground Up
2nd Edition Preface
Preface
Acknowledgments
Contents
Chapter 1
Why SYSTEMC: ESL and TLM
1.1 .Introduction
1.2 .ESL Overview
1.2.1 .Design Complexity
1.2.2 .Shortened Design Cycle = Need For Concurrent Design
1.2.2.1 .Traditional System Design Approach
1.3 .Transaction-Level Modeling
1.3.1 .Abstraction Models
1.3.2 .An Informal Look at TLM
1.3.3 .TLM Methodology
1.3.3.1 .Algorithmic Modeling
1.3.3.2 .Architectural Modeling
1.3.3.3 .Virtual Software Development Platform
1.3.3.4 .Hardware Refinement
1.3.3.5 .Functional and Architectural Verification
1.4 .A Language for ESL and TLM: SystemC
1.4.1 .Language Comparisons and Levels of Abstraction
1.4.2 .SystemC: IEEE 1666
1.4.3 .Common Skill Set
1.4.4 .Proper Simulation Performance and Features
1.4.5 .Productivity Tool Support
1.4.6 .TLM Concept Support
1.5 .Conclusion
Chapter 2
Overview of SystemC
2.1 .C++ Mechanics for SystemC
2.2 .SystemC Class Concepts for Hardware
2.2.1 .Time Model
2.2.2 .Hardware Data Types
2.2.3 .Hierarchy and Structure
2.2.4 .Communications Management
2.2.5 .Concurrency
2.2.6 .Summary of SystemC Features for Hardware Modeling
2.3 .Overview of SystemC Components
2.3.1 .Modules and Hierarchy
2.3.2 .SystemC Threads and Methods
2.3.3 .Events, Sensitivity, and Notification
2.3.4 .SystemC Data Types
2.3.5 .Ports, Interfaces, and Channels
2.3.6 .Summary of SystemC Components
2.4 .SystemC Simulation Kernel
Chapter 3
Data Types
3.1 .Native C++ Data Types
3.2 .SystemC Data Types Overview
3.3 .SystemC Logic Vector Data Types
3.3.1 .sc_bv.
3.3.2 .sc_logic and sc_lv.
3.4 .SystemC Integer Types
3.4.1 .sc_int.. and sc_uint.
3.4.2 .sc_bigint.. and sc_biguint.
3.5 .SystemC Fixed-Point Types
3.6 .SystemC Literal and String
3.6.1 .SystemC String Literals Representations
3.6.2 .String Input and Output
3.7 .Operators for SystemC Data Types
3.8 .Higher Levels of Abstraction and the STL
3.9 .Choosing the Right Data Type
3.10 .Exercises
Chapter 4
Modules
4.1 .A Starting Point: sc_main
4.2 . The Basic Unit of Design: SC_MODULE
4.3 .The SC_MODULE Class Constructor: SC_CTOR
4.4 .The Basic Unit of Execution: Simulation Process
4.5 .Registering the Basic Process: SC_THREAD
4.6 .Completing the Simple Design: main.cpp
4.7 .Alternative Constructors: SC_HAS_PROCESS
4.8 .Two Styles Using SystemC Macros
4.8.1 .The Traditional Coding Style
4.8.2 .Recommended Alternate Style
4.9 .Exercises
Chapter 5
A Notion of Time
5.1 .sc_time
5.1.1 .SystemC Time Resolution
5.1.2 .Working with sc_time
5.2 .sc_time_stamp()
5.3 .sc_start()
5.4 .wait(sc_time)
5.5 .Exercises
Chapter 6
Concurrency
6.1 .Understanding Concurrency
6.2 .Simplified Simulation Engine
6.3 .Another Look at Concurrency and Time
6.4 .The SystemC Thread Process
6.5 .SystemC Events
6.5.1 Causing Events
6.6 .Catching Events for Thread Processes
6.7 .Zero-Time and Immediate Notifications
6.8 .Understanding Events by Way of Example
6.9 .The SystemC Method Process
6.10 .Catching Events for Method Processes
6.11 .Static Sensitivity for Processes
6.12 .Altering Initialization
6.13 .The SystemC Event Queue
6.14 .Exercises
Chapter 7
Dynamic Processes
7.1 .Introduction
7.2 .sc_spawn
7.3 .Spawn Options
7.4 .A Spawned Process Example
7.5 .SC_FORK/SC_JOIN
7.6 .Process Control Methods
7.7 . Exercises
Chapter 8
Basic Channels
8.1 .Primitive Channels
8.2 .sc_mutex
8.3 .sc_semaphore
8.4 .sc_fifo
8.5 .Exercises
Chapter 9
Evaluate-Update Channels
9.1 .Completed Simulation Engine
9.2 .SystemC Signal Channels
9.3 .Resolved Signal Channels
9.4 .Template Specializations of sc_signal Channels
9.5 .Exercises
Chapter 10
Structure
10.1 .Module Hierarchy
10.2 .Direct Top-Level Implementation
10.3 .Indirect Top-Level Implementation
10.4 .Direct Submodule Header-Only Implementation
10.5 .Direct Submodule Implementation
10.6 .Indirect Submodule Header-Only Implementation
10.7 .Indirect Submodule Implementation
10.8 .Contrasting Implementation Approaches
10.9 .Exercises
Chapter 11
Communication
11.1 .Communication: The Need for Ports
11.2 .Interfaces: C++ and SystemC
11.3 .Simple SystemC Port Declarations
11.4 .Many Ways to Connect
11.5 .Port Connection Mechanics
11.6 .Accessing Ports From Within a Process
11.7 .Exercises
Chapter 12
More on Ports & Interfaces
12.1 .Standard Interfaces
12.1.1 .SystemC FIFO Interfaces
12.1.2 SystemC Signal Interfaces
12.1.3 sc_mutex and sc_semaphore Interfaces
12.2 .Sensitivity Revisited: Event Finders and Default Events
12.3 .Specialized Ports
12.4 .The SystemC Port Array and Port Policy
12.5 .SystemC Exports
12.6 .Connectivity Revisited
12.7 .Exercises
Chapter 13
Custom Channels and Data
13.1 .A Review of SystemC Channels and Interfaces
13.2 .The Interrupt, a Custom Primitive Channel
13.3 .The Packet, a Custom Data Type for SystemC
13.4 .The Heartbeat, a Custom Hierarchical Channel
13.5 .The Adaptor, a Custom Primitive Channel
13.6 .The Transactor, a Custom Hierarchical Channel
13.7 .Exercises
Chapter 14
Additional Topics
14.1 .Error and Message Reporting
14.2 .Elaboration and Simulation Callbacks
14.3 .Configuration
14.4 .Programmable Structure
14.5 .sc_clock, Predefined Processes
14.6 .Clocked Threads, the SC_CTHREAD
14.7 .Debugging and Signal Tracing
14.8 .Other Libraries: SCV, ArchC, and Boost
14.9 .Exercises
Chapter 15
SCV
15.1 .Introduction
15.2 . Data Introspection
15.2.1 .Components for scv_extension Interface
15.2.2 .Built-In scv_extensions
15.2.3 .User-Defined Extensions
15.3 .scv_smart_ptr Template
15.4.1 .Global Configuration
15.4.2 .Basic Randomization
15.4.3 .Constrained Randomization
15.5 .Callbacks
15.6 .Sparse Arrays
15.7 .Transaction Sequences
15.8 .Transaction Recording
15.9 .SCV Tips
15.10 .Exercises
Chapter 16
OSCI TLM
16.1 .Introduction
16.2 .Architecture
16.3 .TLM Interfaces
16.3.1 .Unidirectional Blocking Interfaces
16.3.2 .Unidirectional Non-Blocking Interfaces
16.3.3 .Bidirectional Blocking Interface
16.4 .TLM Channels
16.5 .Auxiliary Components
16.5.1 .TLM Master
16.5.2 .TLM Slave
16.5.3 .Router and Arbiter
16.6 .A TLM Example
16.7 .Summary
16.8 .Exercises
Chapter 17
Odds & Ends
17.1 .Determinants in Simulation Performance
17.1.1 .Saving Time and Clocks
17.1.2 .Moving Large Amounts of Data
17.1.3 .Too Many Channels
17.1.4 .Effects of Over Specification
17.1.5 .Keep it Native
17.1.6 . C++ Compiler Optimizations
17.1.7 .C++ Compilers
17.1.8 .Better Libraries
17.1.9 .Better and More Simulation Computers
17.2 .Features of the SystemC Landscape
17.2.1 .Things You Wish Would Just Go Away
17.2.2 .Development Environment
17.2.3 .Conventions and Coding Style
17.3 .Next Steps
17.3.1 .Guidelines for Adopting SystemC
There are a number of companies supporting SystemC methodologies. A quick visit to the OSCI web site www.systemc.org can
Appendix A
C++ Basics
A.1 Background of C++
A.2 Structure of a C Program
A.3 Comments
A.4 Streams (I/O)
A.4.1 Streaming vs. printf
A.5 Basic C Statements
A.5.1 Expressions and Operators
A.5.2 Conditional
A.5.3 Looping
A.5.4 Altering Flow
A.6 Data Types
A.6.1 Built-In Data Types
A.6.2 User-Defined Data Types
A.6.2.1 Pointers, Arrays, and References
A.6.2.2 Structures
A.6.2.3 STL
A.6.3 Constants
A.6.4 Declaration vs. Definition
A.7 Functions
A.7.1 Pass By Value and Return
A.7.2 Pass by Reference
A.7.3 Overloading
A.7.4 Constant Arguments
A.7.5 Defaults for Arguments
A.7.6 Operators as Functions
A.8 Classes
A.8.1 Member Data and Member Functions
A.8.2 Constructors and Destructors
A.8.2.1 Initialization
A.8.3 Destructors
A.8.4 Inheritance
A.8.4.1 Adding Members
A.8.4.2 Initialization of a Base Class
A.8.4.3 Overriding Inherited Member Functions
A.8.4.4 Multiple Inheritance
A.8.5 Public, Private and Protected Access
A.8.5.1 Friends
A.8.6 Polymorphism
A.8.6.1 Virtual
A.8.6.2 Abstract and Interface Classes
A.8.7 Constant Members
A.8.8 Static Members
A.9 Templates
A.9.1 Defining Template Functions
A.9.2 Using Template Functions
A.9.3 Defining Template Classes
A.9.4 Using Template Classes
A.9.5 Template Considerations
A.10 Names and Namespaces
A.10.1 Meaningful Names
A.10.2 Ordinary Scope
A.10.3 Defining Namespaces
A.10.4 Using Names and Namespaces
A.10.5 Anonymous Namespaces
A.11 Exceptions
A.11.1 Watching for and Catching Exceptions
A.11.2 Throwing Exceptions
A.11.3 Functions that Throw
A.12 Standard Library Tidbits
A.12.1 Strings
A.12.2 File I/O
A.12.3 Standard Template Library
A.13 Closing Thoughts
A.14 References
SystemC: From the Ground Up
David C. Black ● Jack Donovan Bill Bunton ● Anna Keist SystemC: From the Ground Up
David C. Black XtremeEDA Austin, TX 78749 USA dcblack@eslx.com Bill Bunton LSI Corporation Austin, TX 78749 USA Jack Donovan HighIP Design Company Round Rock, TX 78764 USA jack@donovanweb.org Anna Keist XtremeEDA Austin, TX 78749 USA ISBN 978-0-387-69957-8 DOI 10.1007/978-0-387-69958-5 Springer New York Dordrecht Heidelberg London e-ISBN 978-0-387-69958-5 Library of Congress Control Number: 2009933997 © Springer Science+Business Media, LLC 2010 All rights reserved. This work may not be translated or copied in whole or in part without the written permission of the publisher (Springer Science+Business Media, LLC, 233 Spring Street, New York, NY 10013, USA), except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed is forbidden. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)
This book is dedicated to our spouses Pamela Black, Carol Donovan, Evelyn Bunton, and Rob Keist and to our children Christina, Loretta, & William Black, Chris, Karen, Jenny, & Becca Donovan, John Williams & Sylvia Headrick, Alex, Madeline, and Michael Keist
2nd Edition Preface Why the 2nd Edition? The reader (or prospective buyer of this book) might ask about the need for a second edition. The first edition was highly successful and progressed to a second and third life after being translated to Japanese and Korean. There are three over-arching reasons for the second edition: – – – A fast changing technical landscape Incorporation of additional topic suggestions from readers Fixing of errors and improvement of confusing text segments and chapters To address the shifting technical landscape, we have significantly updated the chapters addressing Electronic System-Level design to reflect the refinements of ESL methodology thinking in the industry. Although this is not a complete dis- cussion of ESL, it is an overview of the industry as currently viewed by the authors. We have added a chapter on TLM, a standard that will enable interoperability of models and a model marketplace. Although this chapter discusses TLM 1.0, we think it imparts to the reader a basic understanding of TLM. Those of you who fol- low the industry will note that this is not TLM 2.0. This new standard was still emerging during the writing of this edition. But not to worry! Purchasers of this edition can download an additional chapter on TLM 2.0 when it becomes available within the next six months at www.scftgu.com. Although SystemC is now IEEE 1666 it is not immune from the shifting techni- cal landscape, so the authors have included material on some proposed extensions to the SystemC standard related to process control. Readers have suggested several additional topics over the last several years and we have tried to address these with an additional chapter on the SystemC Verification (SCV) Library and an appendix on C++ fundamentals. The chapter on the SCV library is a high level introduction and points the reader to additional resources. The authors have found that many organizations have started using the SCV library after becoming familiar with SystemC and ESL meth- odologies. For those readers, we have added this chapter. vii
viii 2nd Edition Preface The authors received several suggestions asking us to add examples and com- parisons to HDL languages like Verilog and VHDL. The authors have respectfully declined, as we feel this actually impedes the reader from seeing the intended uses of SystemC. After exploring these suggestions, we have found that these readers were not entirely comfortable with C++, and because C++ is fundamental to an understanding of SystemC, this edition includes a special appendix that attempts to highlight those aspects of C++ that are important prerequisites, which is most of the language. Writing a book of this type is very humbling, as most who have journeyed on similar endeavors will confirm. Despite our best efforts at eliminating errors from the first edition, the errata list had grown quite long. We have also received feed- back that certain portions of the book were “confusing” or “not clear”. After reviewing many of these sections, we had to ask: What were we thinking? (a ques- tion asked by many developers when they revisit their “code” after several years) In some cases we were obviously “not thinking”, so several chapters and sec- tions of chapters have been significantly updated or completely rewritten. The topic of concurrency proved a more challenging concept to explain than the authors first thought. This edition effectively rewrote the chapters and sections dealing with the concept of concurrency. The authors have been quite gratified at the acceptance of the first edition and the rapid adoption of SystemC. We hope we have played at least a small part in the resulting changes to our community. We wish you good luck with SystemC and your contributions to our community. Jack Donovan, David Black, Bill Bunton, Anne Keist 4authors@scftgu.com
Preface Jack Donovan, David Black, Bill Bunton, and Anne Keist Why This Book The first question any reader should ask is “Why this book?” We decided to write this book after learning SystemC using minimal documentation to help us through the quest to deeper understanding of SystemC. After teaching several SystemC classes, we were even more convinced that an introductory book focused on the SystemC language was needed. We decided to contribute such a book. This book is about SystemC. It focuses on enabling the reader to master the language. The reader will be introduced to the syntax and structure of the language, and the reader will also learn a few techniques for use of SystemC as a tool to shorten the development cycle of large system designs. We allude to system design techniques and methods by way of examples throughout the book. Several books that discuss system-level design methodology are available, and we believe that SystemC is ideally suited to implement many of these methods. After reading this resource, the reader should not only be adept at using SystemC constructs, but also should have an appreciation of how the con- structs can be used to create high performance simulation models. We believe there is enough necessary information about SystemC to learn the lan- guage that a stand-alone book is justified. We hope you agree. We also believe that there is enough material for a second book that focuses on using SystemC to imple- ment these system-level design methods. With reader encouragement, the authors have started on a second book that delves deeper into the application of the language. Prerequisites for This Book As with every technical book, the authors must write the content assuming a basic level of understanding; this assumption avoids repeating most of an engineering undergraduate curriculum. For this book, we assumed that the reader has a working knowledge of C++ and minimal knowledge of hardware design. For C++ skills, we do not assume that the reader is a “wizard”. Instead, we assumed that you have a good knowledge of the syntax, the object-oriented ix
分享到:
收藏