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 Language Support<br />

Example 7-7 8 Bit Register with Asynchronous Reset (high-true)<br />

Using an Always Block<br />

module EXAMPLE (DI, CLK, RST, DO);<br />

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

input CLK, RST;<br />

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

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

always @(posedge CLK or posedge RST)<br />

if (RST == 1’b1)<br />

DO = 8’b00000000;<br />

else<br />

DO = DI;<br />

endmodule<br />

The following example describes an 8-bit counter.<br />

Example 7-8 8 Bit Counter with Asynchronous Reset (low-true)<br />

Using an Always Block<br />

module seq2 (CLK, RST, DO);<br />

input CLK, RST;<br />

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

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

always @(posedge CLK or posedge RST)<br />

if (RST == 1’b1)<br />

DO = 8’b00000000;<br />

else<br />

DO = DO + 8’b00000001;<br />

endmodule<br />

XST <strong>User</strong> <strong>Guide</strong> 7-17

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

Saved successfully!

Ooh no, something went wrong!