Adsp Manual
Adsp Manual
Adsp Manual
LABORATORY MANUAL
Name: ..............................................................
Year-Section: ....................................................
Department: .....................................................
INDEX
7
EX NO:1 DATE:
AIM:
THEORY:
Shift register are the registers which are used to shift the stored bit
in one or both directions. In this section, shift register is implemented
which can be used for shifting data in both direction. Further it can be
used as parallel to serial converter or serial to parallel converter. Verilog
files required for this example are listed below.
PROCEDURE:
To start ISE, double click the desktop icon, Xilinx ISE 8.2i (or)
start - > All programs - > Xilinx 8.2i - > Project navigator.
To create a new project: Select File > New Project... The New Project Wizard
appears.
PROGRAM:
module shift_register #(
parameter N = 8)(
if(reset)
endcaseend
OUTPUT
RESULT
APPARATUS REQUIRED
THEORY
PROGRAM
Asynchronous counter
module asynchronouscounter(clk, clear, q);
input clk,clear;
output reg [3:0] q;
always @(posedge clk or posedge clear)
q[0]<=~q[0];
always @(posedge q[0] or posedge clear)
q[1]<=~q[1];
always @(posedge q[1] or posedge clear)
q[2]<=~q[2];
always @(posedge q[2] or posedge clear)
begin
if(clear)
q =4'b0000;
else
q[3]=~q[3];
end
Endmodule
OUTPUT
RESULT
Thus the Asynchronous Counter was designed, simulated and
extracted successfully using Xilinx tool.
EX NO:3 DATE:
AIM
To design and simulate the Updown Counter using XILINX tool.
APPARATUS REQUIRED
THEORY
Up down counter
module updowncounter(clk, clear, updown, q);
input clk,clear,updown;
output reg [3:0] q;
always@(posedge clear or posedge clk)
begin
if(clear)
q <=4'b0000;
else if(updown==0)
q <= q+1'b1;
else
q <= q-1'b1;
end
endmodule
OUTPUT
RESULT
Thus the Updown Counter was designed, simulated and extracted successfully
using Xilinx tool.
EX NO:4 DATE:
AIM
APPARATUS REQUIRED
THEORY
In some cases, output signal values can only be assigned after the Verilog
simulator executes a procedure to check the status of one or more of the
input signals. Consider a flip-flop for example. A simple “if-then”
procedure must be executed to determine if an active clock edge has just
occurred before a new output value can be assigned: “if a rising clock
edge has occurred, then assign the output Q the value present on the input
D”. Verilog includes procedural assignment statements to check
conditions like this prior to making an assignment.
The example code below illustrates Verilog code for defining various
memory devices.
D-Latch. Note the sensitivity list contains the Gate, Reset and Data
signals, because changes on any of these signals can cause the output to
change state. Also note Rst is checked first - if reset is asserted, the output
is driven to ‘0’ and the always block is exited.
The example code below shows the same D-Latch code, but the
sensitivity list signals are replaced by the wild card character “*”. Using
the wild card character directs the synthesizer to construct a sensitivity
list that includes all signals on the right-hand side of assignment
statements that can cause output changes.
PROCEDURE
To start ISE, double click the desktop icon, Xilinx ISE 8.2i (or)
start - > All programs - > Xilinx 8.2i - > Project navigator.
Select File > New Project... The New Project Wizard appears.
1. Type project name in the Project Name field. Verify that HDL is
selected from the Top-Level Source Type list.
2. Click Next to move to the device properties page.
3. Fill in the properties in the table as shown below:
♦ Product Category: All
♦ Family: Spartan3
♦ Device: XC3S400
♦ Package: PQ208
♦ Speed Grade: -4
♦ Top-Level Module Type: HDL
♦ Synthesis Tool: XST (VHDL/Verilog)
♦ Simulator: ISE Simulator (VHDL/Verilog)
♦ Verify that Enable Enhanced Design Summary is
selected.
4. Keep other properties as such and click next (3 times)
5. Project summary window will open. Click finish.
To Create a Verilog Source
1.Sources - > XC3S400-4PQ208 (right click) - > Click the New Source
button. New Project Wizard will open.
2.Select Verilog Module as the source type. Type file name. Click Next.
3.Define module will open. Click next.
4.New source wizard summary will open. Click finish.
5.Minimize the design summary & maximize the verilog program editor.
6.Type the program and save.
7.Check synthesis/implementation option is selected in sources for
window.
8.Expand synthesis XST (in processes window) & double click check
syntax.
9.Expand synthesis XST (in processes window) & double click view RTL
schematic. Double click in the symbol, to view the logic diagram.
Close the RTL window.
To verify functionality using Behavioral simulation
1.Select behavioral simulation in sources for window.
2.Select the verilog file in the Sources window.
3.Create a new test bench source by selecting Project → New Source.
4.In the New Source Wizard, select Test Bench Waveform as the source
type, and type file name in the File Name field. Click next (2 times).
5.The New source wizard Summary will open. Click finish.
6.Initial timing & clock wizard will open. Select clock information - >
single clock. Keep other settings as such. Click finish.
7.Set the input waveforms, save & close the test bench waveform window.
8.Select the test bench waveform file in the hierarchy.
9.Expand the Xilinx ISE simulator in processes window. Double click
simulate behavioral model.
10. Click the simulation tab, to view the simulation results.
PROGRAM
D-Flip-Flop.
Begin
else Q <= D;
End
D-Latch.
if (rst == 1)
else if (G == 1)
Q <= D;end
OUTPUT
D Flip-Flop.
D LATCH
RESULT
AIM
THEORY
OUTPUT
RESULT
AIM
APPARATUS REQUIRED
THEORY
PROCEDURE
To start ISE, double click the desktop icon, Xilinx ISE 8.2i (or)
start - > All programs - > Xilinx 8.2i - > Project navigator.
To create a new project: Select File > New Project... The New Project
Wizard appears.
1. Type project name in the Project Name field. Verify that HDL is
selected from the Top-Level Source Type list.
2. Click Next to move to the device properties page.
3. Fill in the properties in the table as shown below:
♦ Product Category: All
♦ Family: Spartan3
♦ Device: XC3S400
♦ Package: PQ208
♦ Speed Grade: -4
♦ Top-Level Module Type: HDL
♦ Synthesis Tool: XST (VHDL/Verilog)
♦ Simulator: ISE Simulator (VHDL/Verilog)
♦ Verify that Enable Enhanced Design Summary is
selected.
4.Keep other properties as such and click next (3 times)
5.Project summary window will open. Click finish.
To Create a Verilog Source
1. Sources - > XC3S400-4PQ208 (right click) - > Click the New Source
button. New Project Wizard will open.
2. Select Verilog Module as the source type. Type file name. Click Next.
3. Define module will open. Click next.
4. New source wizard summary will open. Click finish.
5. Minimize the design summary & maximize the verilog program
editor.
6. Type the program and save.
7. Check synthesis/implementation option is selected in sources for
window.
8. Expand synthesis XST (in processes window) & double click check
syntax.
9. Expand synthesis XST (in processes window) & double click view
RTL schematic. Double click in the symbol, to view the logic
diagram. Close the RTL window.
To verify functionality using Behavioral simulation
1. Select behavioral simulation in sources for window.
2. Select the verilog file in the Sources window.
3. Create a new test bench source by selecting Project → New Source.
4. In the New Source Wizard, select Test Bench Waveform as the
source type, and type file name in the File Name field. Click next
(2 times).
5. The New source wizard Summary will open. Click finish.
6. Initial timing & clock wizard will open. Select clock information -
> single clock. Keep other settings as such. Click finish.
7. Set the input waveforms, save & close the test bench waveform
window.
8. Select the test bench waveform file in the hierarchy.
9. Expand the Xilinx ISE simulator in processes window. Double
click simulate behavioral model.
10.Click the simulation tab, to view the simulation results.
PROGRAM
module alu(
);
always @(*)
begin
case(ALU_Sel)
4'b0000: // Addition
ALU_Result = A + B ;
4'b0001: // Subtraction
ALU_Result = A - B ;
4'b0010: // Multiplication
ALU_Result = A * B;
4'b0011: // Division
ALU_Result = A/B;
ALU_Result = A<<1;
ALU_Result = A>>1;
ALU_Result = {A[6:0],A[7]};
ALU_Result = {A[0],A[7:1]};
ALU_Result = A & B;
4'b1001: // Logical or
ALU_Result = A | B;
ALU_Result = (A>B)?8'd1:8'd0 ;
ALU_Result = (A==B)?8'd1:8'd0 ;
default: ALU_Result = A + B ;
endcase
end
endmodule
OUTPUT
RESULT
AIM
THEORY
A 4-bit multiplication the algorithm will complete in no more than
4 cycles. The technique is simply one of long multiplication. Below you
can see the long multiplication of two 4-bit values to produce an 8-bit
result.
PROCEDURE
To start ISE, double click the desktop icon, Xilinx ISE 8.2i (or)
start - > All programs - > Xilinx 8.2i - > Project navigator.
To create a new project: Select File > New Project... The New Project
Wizard appears.
PROGRAM
RESULT
Thus the 4 Bit Multiplier was designed, simulated and extracted
successfully using Xilinx tool.