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.

XST <strong>User</strong> <strong>Guide</strong><br />

Verilog<br />

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

module addsub(A, B, OPER, RES);<br />

input OPER;<br />

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

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

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

reg [7:0] RES;<br />

always @(A or B or OPER)<br />

begin<br />

if (OPER==1'b0) RES = A + B;<br />

else RES = A - B;<br />

end<br />

endmodule<br />

2-110 <strong>Xilinx</strong> Development System

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

Saved successfully!

Ooh no, something went wrong!