Computer Architecture Lab 2
Computer Architecture Lab 2
LAB # 2
Introduction to Gate level & Dataflow Modelling
through implementation of Carry Look Ahead at gate level and its
simulation using Xilinx ISE tools and implementation on FPGA
board.
NOTE: Use the name of new source same as that of verilog modules present in
notepad files.
Procedure:
1. Launch the Xilinx ISE 7.1 software as follows:
Start >> Programs >> Xilinx ISE 7.1 >> Project Navigator
6. Click Next.
7. In the next window of ‘Select Device and Design Flow for the Project’:
Select the simulator as : ISE simulator
In the Device Family option,
Select Spartan3
In the Device option
Select xc3s200
In the Package option
Select ft256
In the Speed Grade option
Select -5
In the Top Level Module Type option
Select HDL
In the Synthesis Tool option
Select XST(VHDL/Verilog)
In the Simulator option
Select ISE Simulator
In the Generated Simulation Language option
Select Verilog
Codes of following are available & Present in a notepad file. Just copy
from there and paste.
input a, b;
output sum, carry;
assign sum = a ^ b;
assign carry = a & b;
endmodule
16. Repeat step 11,12,13 & 14 but save now file name as cla_gen.
input [3:0] p, g;
input ci;
output [3:0] c;
assign c[0] =
ci;
assign c[1] =
g[0] | (p[0]&c[0]);
assign c[2] =
g[1] | (p[1]&g[0]) | (p[1]&p[0]&c[0]);
assign c[3] =
g[2] | (p[2]&g[1]) | (p[2]&p[1]&g[0]) |
(p[2]&p[1]&p[0]&c[0]);
assign c[4] = g[3] | (p[3]&g[2]) | (p[3]&p[2]&g[1]) |
(p[3]&p[2]&p[1]&c[0]) | (p[3]&p[2]&p[1]&p[0]&c[0]);
endmodule
18. Now copy the following code and see the difference between the synthesis
implementation (RTL) of both these code.
input [3:0] p, g;
input cin;
output [4:0] cout;
endmodule
19. Repeat Step 17 with file name as four_Bit_add. And use the following code.
module four_bit_add (A, B, C_in, S, C_out);
input [3:0] A, B;
input C_in;
output [3:0] S;
output C_out;
wire [3:0] P, G;
wire [4:0] C;
Points to Ponder:
• Synthesis the four_bit_add.
• See the test bench waveform.
• Implement on FPGA board. (Spartan 3)
ASSIGNMENT (To do in today lab session):
a) To implement 16 bit adder, using four 4 bits as a block with carry lookahead, and
still use ripple carry between the blocks.
The code of four_bit is as follows which has PG and GG additional output to extend
the carry lookahead block to level 2.(also C_out is missing in this new block. )
input [3:0] A, B;
input C_in;
output [3:0] S;
output PG, GG;
wire [3:0] P, G;
wire [4:0] C;
endmodule
// end
// Final code
module carry_look(A, B, C_in, Sum, Cout);
input [15:0] A ,B ;
input C_in;
output [15:0] Sum;
output Cout;