05.07.2013 Views

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Verilog Code<br />

HDL Coding Techniques<br />

Following is the Verilog code for an 8-bit shift-left register with a<br />

positive-edge clock, asynchronous parallel load, serial in, and serial<br />

out.<br />

module shift (C, ALOAD, SI, D, SO);<br />

input C,SI,ALOAD;<br />

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

output SO;<br />

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

always @(posedge C or posedge ALOAD)<br />

begin<br />

if (ALOAD)<br />

tmp = D;<br />

else<br />

begin<br />

tmp = {tmp[6:0], SI};<br />

end<br />

end<br />

assign SO = tmp[7];<br />

endmodule<br />

8-bit Shift-Left Register with Positive-Edge Clock,<br />

Synchronous Parallel Load, Serial In, and Serial Out<br />

Note For this example XST will not infer SRL16.<br />

The following table shows pin definitions for an 8-bit shift-left<br />

register with a positive-edge clock, synchronous parallel load, serial<br />

in, and serial out.<br />

IO Pins Description<br />

C Positive-Edge Clock<br />

SI Serial In<br />

SLOAD Synchronous Parallel Load (active High)<br />

D[7:0] Data Input<br />

SO Serial Output<br />

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

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

Saved successfully!

Ooh no, something went wrong!