Verilog HDL
Verilog HDL
Verilog HDL
with
Verilog HDL
Eli Sternheim, Ph.D. interHDL, Inc. Rajvir Singh interHDL, Inc. Rajeev Madhavan Cadence Design System,Inc. Yatin Trivedi YT Associates
1/40
Chapter 1
Why hardware description languages?
Evolutionary trends in design methods.
The use of hardware description languages (HDLs) for logic design has greatly expanded in the last few years. Engineering managers no longer face the dilemma of whether to design with an HDL or not.
2/40
3/40
4/40
5/40
Chapter 2
Anatomy of the Verilog HDL
In this chapter we introduce the Verilog hardware description language through a sequence of examples. A more complete specification of the language can be found in the Language Reference Manual and in the Condensed Reference Manual in Appendix A.
6/40
//structural module AND2 (in1, in2, out); input in1; input in2; output out; wire in1, in2, out; and u1 (out, in1, in2); endmodule
7/40
output out;
wire in1, in2, out; assign out = in1 & in2; endmodule
8/40
9/40
Test results
i1=0, i2=0, o=0 i1=0, i2=1, o=0 i1=1, i2=0, o=0 i1=1, i2=1, o=1
10/40
11/40
12/40
13/40
14/40
Operator Precedence
* / % Highest precedence + << >> < <= > >= = = != = = = != = & ^ ^~ | && Lowest precedence
15/40
16/40
17/40
18/40
A case statement
module case _statement; integer i; initial i=0; always begin $display ( i= %0d, i); case ( i ) 0: i = i + 2; 1: i = i + 7; 2: i = i + 1; default: $stop; endcase end endmodule
19/40
A forever loop
module forever_statement ( a, b, c ); input a, b, c; initial forever begin @( a or b or c ) if ( a + b = = c ) begin $display (a( %d) + b( %d) = c(%d),a ,b, c); $stop; end end endmodule
20/40
21/40
22/40
23/40
Example of disable
module disable_block; event a, b; //Block name is needed fork : block @a disable block 1; @b disable block 1; join endmodule
24/40
Example of a task
task tsk; input i1, i2; output o1, o2; $display ( Task tsk, i1=%0b, i2=%0b , i1, i2 ); #1 o1 = i1 & i2; #2 o2 = i1 | i2; endtask
25/40
26/40
27/40
28/40
29/40
30/40
31/40
Chapter 3
Modeling a Pipelined Processor
In this chapter we take the specification of a 32-bit processor and develop a functional model for it through various stages of successive refinement. First we implement an instruction set model, then we describe a register transfer level (RTL) model. In the next chapter we arrive at a structural model that maps the processor to various building blocks. In the process, we explain modeling of such concepts as pipelining, concurrency, instruction execution, functional partitioning, and creation of test vectors.
32/40
33/40
Chapter 4
Modeling System Blocks
In the previous chapter we saw how to model a processor at the instruction set level and its function at the behavioral level. In this chapter we present a structural model of the SISC processor and show how to model its various building blocks. We begin with the block diagram of the SISC processor and present its corresponding structural model to show the interconnections of its building blocks. In subsequent sections we develop functional models for these blocks, namely, the datapath, the memory elements, the clock generator and the control unit.
34/40
Chapter 5
Modeling Cache Memories
In this chapter we examine the process of designing a simple cache system in Verilog HDL. The description can be synthesized to obtain a gate level implementation. At the end of this chapter we consider ways to improve the basic design.
35/40
36/40
Chapter 6
Modeling Asynchronous I/O: UART
In this chapter we present an example of modeling an asynchronous peripheral device, a dual Universal Asynchronous Receiver Transmitter (UART) chip. We develop two models of the chip. The first model is a high-level abstraction which describes the functionality of the chip and emphasizes simplicity, readability and ease of change. The second model is oriented toward gate-level implementation. This model is partitioned so that a logic synthesizer can be used to automatically implement the chip with library components.
37/40
Chapter 7
Verilog HDL for Synthesis
In the previous chapters we introduced Verilog HDL and showed how it can be used in different ways to support top-down hierarchical design. In this chapter we cover the basics of synthesis, discuss how Verilog may be used for synthesis and describe how modeling for synthesis affects the coding style, the design organization and partitioning.
38/40
Chapter 8
Modeling a Floppy Disk Subsystem
In this chapter we provide a complete example of a floppy disk subsystem (FDS) model in Verilog. Such a model may be needed when you perform a full system simulation and want to simulate the execution of code which accesses the disk. The FDS model would typically be used to perform a full functional simulation during the development of a CPU board. This example demonstrates the modeling of asynchronous systems, I/O buses, timing constraints, and other techniques of writing large models.
39/40
Chapter 9
Useful Modeling and Debugging Techniques
Learning to design and simulate in Verilog is more then just learning the syntax and semantics of the language. As in every learning process, the best way to learn is by doing. As you start using the language, you will develop your own style of design, and you will discover techniques for modeling in Verilog. In this chapter we present some tips and techniques that we hope will help you in developing your own techniques on the way to mastering Verilog.
40/40