BSV by Example - Computation Structures Group
BSV by Example - Computation Structures Group
BSV by Example - Computation Structures Group
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
15 Importing existing RTL into a <strong>BSV</strong> design 150<br />
15.1 Using an existing interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151<br />
15.1.1 Module header definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151<br />
15.1.2 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152<br />
15.1.3 Clocks and Resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152<br />
15.1.4 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153<br />
15.2 Defining a new interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />
A Source Files 157<br />
A.1 Getting started with <strong>BSV</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157<br />
A.1.1 A simple example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157<br />
A.1.2 Testbench communicating with DUT . . . . . . . . . . . . . . . . . . . . . . . 158<br />
A.1.3 Multiple packages in a single design . . . . . . . . . . . . . . . . . . . . . . . 158<br />
A.2 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159<br />
A.2.1 Using abstract types instead of Bit . . . . . . . . . . . . . . . . . . . . . . . . 159<br />
A.2.2 Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161<br />
A.2.3 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162<br />
A.3 Variables, assignments, and combinational circuits . . . . . . . . . . . . . . . . . . . 163<br />
A.3.1 Variable declaration and initialization . . . . . . . . . . . . . . . . . . . . . . 163<br />
A.3.2 Combinational circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164<br />
A.4 Rules, registers, and FIFOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165<br />
A.4.1 Defining and updating a Register . . . . . . . . . . . . . . . . . . . . . . . . . 165<br />
A.4.2 Composition of rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166<br />
A.4.3 Multiple registers in a rigid pipeline . . . . . . . . . . . . . . . . . . . . . . . 166<br />
A.4.4 Using register syntax shorthand . . . . . . . . . . . . . . . . . . . . . . . . . . 167<br />
A.4.5 Using valid bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168<br />
A.4.6 Asynchronous pipeline using FIFOs . . . . . . . . . . . . . . . . . . . . . . . 170<br />
A.5 Module hierarchy and interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171<br />
A.5.1 Module hierarchies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171<br />
A.5.2 Implicit conditions of methods . . . . . . . . . . . . . . . . . . . . . . . . . . 172<br />
A.5.3 ActionValue method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173<br />
A.5.4 ActionValue method with type error . . . . . . . . . . . . . . . . . . . . . . . 174<br />
A.5.5 ActionValue method with error in rule condition . . . . . . . . . . . . . . . . 174<br />
A.5.6 Defining an Action function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175<br />
A.5.7 Nested interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176<br />
A.5.8 Standard connectivity interfaces . . . . . . . . . . . . . . . . . . . . . . . . . 178<br />
A.6 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179<br />
6