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 />

Shift Registers<br />

Verilog Code<br />

Following is the Verilog code for a 4-bit unsigned up accumulator<br />

with asynchronous clear.<br />

module accum (C, CLR, D, Q);<br />

input C, CLR;<br />

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

output [3:0] Q;<br />

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

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

begin<br />

if (CLR)<br />

tmp = 4'b0000;<br />

else<br />

tmp = tmp + D;<br />

end<br />

assign Q = tmp;<br />

endmodule<br />

No constraints are available.<br />

In general a shift register is characterized by the following control<br />

and data signals, which are fully recognized by XST:<br />

• clock<br />

• serial input<br />

• asynchronous set/reset<br />

• synchronous set/reset<br />

• synchronous/asynchronous parallel load<br />

• clock enable<br />

• serial or parallel output. The shift register output mode may be:<br />

♦ serial: only the contents of the last flip-flop are accessed by<br />

the rest of the circuit<br />

♦ parallel: the contents of one or several flip-flops, other than<br />

the last one, are accessed<br />

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

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

Saved successfully!

Ooh no, something went wrong!