05.07.2013 Views

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HDL Coding Techniques<br />

Verilog<br />

Following is the Verilog code for an unsigned 8-bit adder with carry<br />

out.<br />

module adder(A, B, SUM, CO);<br />

input [7:0] A;<br />

input [7:0] B;<br />

output [7:0] SUM;<br />

output CO;<br />

wire [8:0] tmp;<br />

assign tmp = A + B;<br />

assign SUM = tmp [7:0];<br />

assign CO = tmp [8];<br />

endmodule<br />

Unsigned 8-bit Adder with Carry In and Carry Out<br />

This section contains VHDL and Verilog code for an unsigned 8-bit<br />

adder with carry in and carry out.<br />

The following table shows pin descriptions for an unsigned 8-bit<br />

adder with carry in and carry out.<br />

IO pins Description<br />

A[7:0], B[7:0] Add Operands<br />

CI Carry In<br />

SUM[7:0] Add Result<br />

CO Carry Out<br />

XST <strong>User</strong> <strong>Guide</strong> 2-105

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!