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

module mux (sel, res);<br />

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

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

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

always @(sel)<br />

begin<br />

case (sel)<br />

3'b000 : res = 8'b00000001;<br />

// unused decoder output<br />

3'b001 : res = 8'bxxxxxxxx;<br />

3'b010 : res = 8'b00000100;<br />

3'b011 : res = 8'b00001000;<br />

3'b100 : res = 8'b00010000;<br />

3'b101 : res = 8'b00100000;<br />

3'b110 : res = 8'b01000000;<br />

default : res = 8'b10000000;<br />

endcase<br />

end<br />

endmodule<br />

On the contrary, the following description leads to the inference of a<br />

1-of-8 decoder.<br />

IO pins Description<br />

s[2:0] Selector<br />

res Data Output<br />

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

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

Saved successfully!

Ooh no, something went wrong!