Saturday, 19 August 2017

FPGA Verilog four bits Carry Look Ahead generate and propagate terms component Structural design



This video is part of a series to design a Controlled Datapath using a structural approach in Verilog. A Structural approach consist in designing all components needed for the design such as gates to form subsystems and then joining them together to form a larger design like adders and Arithmetic logic units.

The design in these labs was first developed in VHDL you can check the final VHDL version in the link below as well as instructions on how to set up the Waveshare development board to get started, the setup is the same for VHDL and Verilog:

The complete vhdl video tutorial at:

https://youtu.be/_lZcWH0gjIw?list=PLZqHwo1YWqVMSdkQOYC_W0o59LWnZvFn4

Lab Sheets:

http://viahold.com/y37

Lab guide

http://cogismith.com/1OwP


 module four_bit_LAC(  
 input [3:0]InA,  
 input [3:0]InB,  
 input C_in,  
 output reg [3:0]C_terms  
   );  
 wire [3:0]G;  
 wire [3:0]P;  
 assign G[3:0] = InA[3:0] & InB[3:0] ;//carry look ahead generate  
 assign P[3:0] = InA[3:0] | InB[3:0] ;//carry look ahead propagate  
 always @*  
 begin  
 C_terms[0] = C_in;  
 C_terms[1] = G[0] | (P[0]& C_in);   
 C_terms[2] = G[1] | ( P[1] & G[0]) | (P[1] & P[0] & C_in);  
 C_terms[3] = G[2] | ( P[2]& G[1]) | (P[2] & P[1] & G[0]) | (P[2] & P[1] & P[0] & C_in) ;  
 end  
 endmodule  


TUTORIAL ON HOW TO ADD TIMING CONSTRAINTS IN A MODULE

No comments:

Post a Comment