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

Casez treats all z values in any bit position of the branch alternative<br />

as a don’t care.<br />

Casex treats all x and z values in any bit position of the branch<br />

alternative as a don’t care.<br />

The question mark (?) can be used as a “don’t care” in any of the<br />

preceding case statements. The following example shows how a<br />

MUX can be described using a Case statement.<br />

Example 7-3 MUX Description Using Case Statement<br />

module mux4 (sel, a, b, c, d, outmux);<br />

input [1:0] sel;<br />

input [1:0] a, b, c, d;<br />

output [1:0] outmux;<br />

reg [1:0] outmux;<br />

always @(sel or a or b or c or d)<br />

begin<br />

case (sel)<br />

2’b00: outmux = a;<br />

2’b01: outmux = b;<br />

2’b10: outmux = c;<br />

default: outmux = d;<br />

endcase<br />

end<br />

endmodule<br />

The preceding Case statement will evaluate the values of the input sel<br />

in priority order. To avoid priority processing, it is recommended that<br />

you use a parallel-case Verilog meta comment which will ensure<br />

parallel evaluation of the sel inputs as in the following.<br />

Example:<br />

always @(sel or a or b or c or d) //synthesis parallel_case<br />

For and Repeat Loops<br />

When using always blocks, repetitive or bit slice structures can also<br />

be described using the "for" statement or the "repeat" statement.<br />

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

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

Saved successfully!

Ooh no, something went wrong!