Welcome, To Be Efficient


Tuesday, July 28, 2009

Basics RTL Synthesis

RTL Synthesis
• Synthesis is an automatic method of converting a higher level of abstraction (RTL) to a lower level of abstraction (gate level netlists).
• Synthesis produces technology-specific implementation from technology-independent VHDL description.
• Not all VHDL can be used for synthesis. There are the VHDL subset for synthesis and synthesis style description.
• Synthesis is very sensitive to how the VHDL code is written!
• Gate level net lists are optimized for area, speed, power, or testability.

• The essence of RTL is that you define all the registers in the system and the transfers between those registers that occur on each clock cycle (i.e., the combinational logic).
• Registers are described either:
1. explicitly through component instantiation, or
2. implicitly through inference (following a few simple rules)
• Combinational logic is described by: sequential control statements, subprograms, or concurrent statements.
• RTL synthesis describes the behavior of system at each clock period.
• RTL synthesis is used for synchronous design.

• An RTL architecture can be divided into a data path and control:
– Data path: performs operations on data (i.e., ALU),
– Control: tells data path, memory, etc. what to do.
• The data path flows left to right, whereas the control flows bottom up.
• Critical path: critical timing path in a logical circuit is the longest sensitizable path from primary inputs to primary outputs.
• The critical path in the circuit limits the maximum clock frequency.
• Synthesis tools examine all signal paths and spot the critical path.

It is recommended to use RTL code whenever possible as it provides the following:
1. Readable code
2. Ability to use same code for synthesis and simulation
3. Portable code for migration to different technologies
4. Reusable code for later designs

Monday, June 29, 2009

The Basics of VHDL

VHDL (VHSIC (Very High Speed Integrated Circuit) Hardware Description Language) is one of the industry standard-hardware description languages. The goals of this handout are to provide some basic features of the VHDL language and its use in specifying and simulating digital systems. VHDL features can be learned similar to any other programming languages such as C.
However, the topics will be presented in all the modules and in the laboratories from a design perspective rather than a language theory perspective. VHDL models of simple circuits will be used to introduce features of the language.
VHDL is a language to describe digital systems. VHDL captures the basic fundamentals and concepts of digital systems. Therefore, learning it will reinforce the theory of digital system design. Additionally, VHDL (along with Verilog) is used as a standard description for communication between different design automation (CAD) tools. VHDL is currently used to specify, simulate and synthesize digital systems. The relationship between VHDL model and actual hardware as shown in Figure 1 focuses on the specification and simulation features of the language. The VHDL model is executed by a program called simulator and the resulting waveforms are obtained as shown in Figure 1(a). A simulator runs the VHDL description with specified inputs and generates the output waveforms of the model as a function of time. If the VHDL model accurately represents actual hardware shown in Figure 1(b), then the input/output behavior of the VHDL model must match that of the hardware. If the input stimuli for the VHDL model and the actual hardware are identical, then the resulting outputs should also be identical as shown in Figure 1.
VHDL is also a synthesis language. CAD tools called synthesizers take VHDL descriptions as input. Using the logic implied or described in these models, synthesizers will (a) optimize logic, and (b) map the logic the VHDL code to a target implementation technology as shown in Figure 2. In this course, we will use Xilinx FPGAs as the target implementation technology. It is very important that the VHDL model is properly specified and simulated prior to the synthesis. This is an important step as the synthesis is a computationally intensive step, particularly, for large designs.
Figure 3 encapsulates major features of VHDL. A single component model consists of one entity and one or more architectures. The entity describes the interface of the digital circuit. At a component level the entity describes the pins (ports). The architecture describes the function of the logic circuit either at a behavioral level (data flow or sequential) or at a structural (component) level.
A package can be used to provide a collection of common declarations and other features for a group of entities and architectures (similar to header files and packages in C). Generics is a method of passing information from external environment (similar to passing static parameter values in C).
The problem that we will be using to illustrate some basic features of the language is a home alarm system described below.
ALARM CIRCUIT SPECIFICATION
Design a home alarm circuit that will generate an ALARM output of 1 if the PANIC input is 1 (panic button is pressed), or if the ENABLE input is 1 (system is enabled), EXITING input is 0, and the house is not secure. The house is secure if the WINDOW, DOOR, and GARAGE inputs are all 1 (windows, garage and doors are closed). You can assume that the sensors and or buttons are used to generate WINDOW, PANIC, EXITING, GARAGE,
DOOR and ENABLE signals.
Figures 4(a), 4(b) and 4(c) show the symbolic, schematic and a VHDL representation of the
library IEEE;
use ieee.std_logic_1164.all;
entity alarm_ckt is
-- Port declarations
port
( DOOR, WINDOW: in STD_LOGIC;
GARAGE : in STD_LOGIC;
EXITING, PANIC: in STD_LOGIC;
ALARM : out STD_LOGIC);
end entity alarm_ckt;
-- Body of the alarm circuit
architecture behav of alarm_ckt is
-- Declarative part
signal secure;
begin
-- Statement part
secure <= window and door and garage; alarm <= panic or (enable and (not exiting) and (not secure); end architecture behav;
Figure 4(c). A VHDL model of the alarm circuit shown in 4(a) and 4(b)

The VHDL model shown in Fig 4© comprises of an entity (interface) and its architecture (body). The interface specifies the communication of the model with the external world such as the signals that flow into and out of the black box that is represented by the entity. Note the similarities between the entity and symbolic model shown in Fig 4(a). The body (architecture) describes the details of the digital system and how the output changes to variations of the inputs. Thus there is a clear separation in the VHDL model in the specification and implementation. Specifications provide the function to be implemented (identifier) and how the design should communicate with the external world. For example, the specification of the alarm circuit is the entity description of Figure 4©. A number of solutions are feasible for the alarm specification each trading one or more of the following features: cost, speed, reliability, power, etc. Some other implementations of alarm circuit will be presented in later modules. In the next few sections the details (syntax) of the entity and architecture are provided. New features of VHDL are presented as we continue through these sections.
INTERFACE
The interface of the alarm circuit is repeated below
entity alarm_ckt is
· Port declarations
port (DOOR, WINDOW, GARAGE : in STD_LOGIC;
EXITING, PANIC: in STD_LOGIC;
ALARM : out STD_LOGIC);
library IEEE;
use ieee.std_logic_1164.all;
entity alarm_ckt is
· Port declarations
port
( DOOR, WINDOW: in STD_LOGIC;
GARAGE : in STD_LOGIC;
EXITING, PANIC: in STD_LOGIC;
ALARM : out STD_LOGIC); end entity alarm_ckt;
· Body of the alarm circuit
architecture behav of alarm_ckt is
· Declarative part
signal secure;
begin
· Statement part
secure <= window and door and garage; alarm <= panic or (enable and (not exiting) and (not secure); end architecture behav; end entity alarm_ckt;
The interface consists of the entity declaration. The header of the entity declaration starts with the keyword entity, followed by the name of the design entity, and followed by the keyword is. Entity declaration closes with the keyword end, followed by an optional keyword entity, followed by the optional entity name. The entity declaration is terminated by a semicolon. The design entity name is an identifier. An identifier may be of any length and is case insensitive. The first character must be a letter and the last character must not be an underscore and can comprise of alphanumeric characters and underscore ( _ ). Lines beginning with two dashes “—“ are comments. Comments can be placed any where within the VHDL code.
The keyword port is used in port declarations. Port declarations are used to specify the name, mode (direction), and type of signals that flow in/out of the design entity. Three commonly used modes of ports are in (input), out (output), and inout (input/output).The type of the port defines the legal values that are allowed at the port. For the time being we will be restricting to bit, std_logic (0 or 1 as values), and Boolean (TRUE or FALSE) data types.
VHDL is a very strongly typed language. Therefore, the port signals data type must match with the signals assigned to the port.
ARCHITECTURE
Following the interface of the alarm circuit, we will look into the body described following.
· Body of the alarm circuit architecture behav of alarm_ckt is
· Declarative part signal secure;
begin
· Statement part
secure <= window and door and garage; alarm <= panic or (enable and (not exiting) and (not secure); end architecture behav; The header of the body begins with the keyword architecture, followed by the architecture name (identifier), followed by the keyword of, followed by the identifier of the design entity, and followed by the key word is. The last statement of the body consists of the keyword end, followed optionally by the keyword architecture and the identifier of the architecture. The architecture primarily consists of two parts: declarative part and statement part. Declarative part declares the data types of objects that are local to the body. Note once again that VHDL is strongly typed. Therefore, all objects must have their data type declared before they are used in the statements. The declarative part effectively extends the header of the architecture to the keyword begin. LOGIC OPERATIONS AND PRECEDENCE VHDL provides a set of predefined logical operators as described below OPERATOR DEFINITION
and conjunction
or disjunction
not complement
nor complement disjunction
nand complement conjunction
xor exclusive disjunction
xnor complement exclusive disjunction


not is a unary operation where as all other logical operations are all binary. The operators in an expression are executed starting from left to right in the order in which they appear. VHDL operators are evaluated in an order determined by the operator precedence. Operators of higher precedence are evaluated before the lower ones. not operator has a higher precedence over all other operators. All other binary operators have equal precedence (different from Boolean logic). Parentheses can be used to control the operator execution.
CONCURRENCY
The assignment statements used in the VHDL model of Figure 4© are called concurrent signal assignment statements. Unlike the assignments done in software programming languages that get executed in a sequential manner, these VHDL signal assignment statements are executed concurrently. The statements get executed whenever a signal value on the right hand side (RHS) of the assignment statement change. There is no implied or explicit procedural flow of control. To visualize this let us look at the logic circuit implemented by the two assignment statements and given in Figure 4©. Thus the concurrent signal assignment statements mimic the nonprocedural characteristics of hardware; the hardware components operate in parallel and will be active whenever one of the inputs of the component changes. The order in which concurrent signal statements are written has no effect on the order in which they execute.
The signal declaration used in the declaration section of the body of the VHDL model starts with the keyword signal followed by the name (identifier) of the signal and its data type. Unlike ports signals do not have a mode or direction of signal flow. A signal in effect represents a wire used to connect logic components. The next two sections illustrate some of the language elements and their organization. Although this deviates from our scheme of presenting VHDL with a design perspective, it provides a good overall description of the organization of the language.
DESIGN UNITS AND LIBRARIES
VHDL language organization is better described in the pyramid structure shown in Figure 5. At the base of the pyramid are the user defined data types and since VHDL is a strongly typed language this forms the foundation. Objects such as signals hold values for the defined data types. Expressions transform or combine operations with these objects. Typically expressions can be viewed as statements within the model. Statements are contained within design units such as entities and architectures. Finally these design units are contained within libraries.
There are five kinds of design units within the VHDL language and they can be categorized as primary and secondary design units.
· Primary design units
1. Entity
2. Package
3. Configuration
· Secondary design units
1. Architectural Body
2. Package Body
Figure 6 illustrates the process of creating a design unit from a textual VHDL models. All design units are stored in libraries. A VHDL compiling and simulating environment typically has a VHDL analyzer, a source-level debugger, a result viewer, and other utilities. A VHDL design file comprises of one or more design entities or units. VHDL analyzer checks the correctness of syntax of the design file. It compiles the textual VHDL code in an intermediate form that is accepted by the VHDL simulator and/or synthesizer. These compiled design units are stored in a design library. The designer specifies one of the design libraries as the WORK library. The compiled unit is stored in the WORK library. The designer can change the mapping of the WORK library. The design environment also provides a library called STD which consists of two predefined packages: STANDARD and TEXTIO. In addition most of the design environments also provide the IEEE standard library which is based on a nine-valued logic, the IEEE standard 1164.
Once all the design units in a complete design are compiled, a top-level design entity or its configuration file is selected for simulation. If simulations thoroughly verify the functioning of design, the VHDL model can be provided as input to synthesizer. The synthesis tool maps the VHDL functionality onto physical hardware or a possible logic circuit that can be physically built as shown in Figure 7

Saturday, June 27, 2009

Verilog

Introduction
Verilog allows us to describe a system based on a structure of wires, gates, registers, and
delays using a systematic language. This language is unlike most other programming languages,
where they read like steps in a recipe. Instead, Verilog is written so that most components
respond in parallel, simultaneously.
First Verilog Program
By using your favorite text processor, you can type in Verilog code to be run using
Verilog and simulated in SignalScan. The simplest type of Verilog code is similar to that found in
Prog.1.
// Prog.1: Simple Verilog Code.
module top();
wire out;
reg a, b;
assign out = a & b;
initial
begin
a = 1'b0;
b = 1'b0;
#10;
a = 1'b0;
b = 1'b1;
#10;
a = 1'b1;
b = 1'b1;
#10;
a = 1'b1;
b = 1'b0;
#10;
$dumpflush;
end
initial
begin
$monitor("a=%b, b=%b, out=%b, time=%t\n", a, b, out, $time);
$dumpfile("top.dump");
$dumpvars(5, top);
end
endmodule


Comments
Let's start by examining the code step by step. The first line is a comment defined by the
two slashes. In any program, anything that follows two slashes is ignored by Verilog.
Modules
Modules are what define components in Verilog. They are remarkably similar to functions
or procedures in other languages because given input, they can produce specific output. The
module shown, top, has no input and output, making it self contained. It will be the first module
evaluated when Verilog is run because of this.
A more general module follows the following form:
module modulename(in1, in2, ..., inout1, ..., out1, ...)
input in1, in2, ...;
inout inout1, ...;
output out1, ...;

endmodule
The modulename can be replaced with any name of the module. Although the inputs,
input/outputs, and outputs can be placed in any order within the module's parameters, it is good
to be consistent where you place them within the list. The keywords, input, inout, and output are
used to define the direction that data can flow through the node named by the parameter. These
keywords are used just like the wire and reg keywords which we'll discuss in more depth later.
The module body or text is a list of expressions that define the system. Modules are always
terminated by the keyword, endmodule.
Defining Wires and Registers
In this example, single bit wires and registers are used, although Verilog allows multi-bit
sized wires (buses) and registers to be defined. Wires, registers, inputs, input/outputs, and
outputs are all defined in the same fashion. The only difference being the keyword used.
input a, b;
output [2:0] out;
wire wire1, wire2, a, b;
wire [7:0] byte;
reg [31:0] wordreg;
A name by itself represents a single bit, or wire node. To produce buses, or larger arrays
of bits, the bracketed expression is placed before the name. [2:0] defines 3 bits, 2 through 0.
[7:0] defines 8 bits, 7 through 0. [31:0] defines 32 bits, 31 through 0.
Registers and wires cannot be used everywhere. In the simple program, out is a wire, and
a and b are registers. This is required because out appears at the left hand side of an assign
expression, and a and b appear at the left hand side of '=' signs in the initial expression.

Friday, June 26, 2009

Digital System

Introduction to the design of combinational systems
Since the invention of the transistor in 1947, digital systems take up an ever-growing part in our lives. Mechanical clocks were replaced with digital ones, the telephony system became digital, information is stored on digital media, digital computers appear everywhere and any car mechanic today will tell you that if you want to fix a modern car, you have to know as much about the car's electronics as you have to know about it's mechanics. The humble silicone microchip has changed every aspect of human life, yet very few people know anything about the "magic" that makes it all possible, in this series of articles I wish to change that. I will talk about the fundamentals of digital design and how digital systems work. The first part of this article deals is an introduction to the first kind of digital systems – combinational systems. The next part will deal with the combinational themselves that will pave us the way to the third part dealing with the more complex sequential systems.
Blog Widget by LinkWithin

Disclaimer

.........................................................................................................................................................
The all content are through my experiences, that i have learn in going through my studies and in building projects, some of were taken from some web sites, books and other sources, where i have visited and learn VLSI, I am very thankful to them for having those valuable things, which make me more efficient in VLSI, and i have added those all in my experience. If any of these content violets copyrights, please contact me i will try to resolve and will do the needful assistance. Thank you all very much.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................