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 (One-Cold)<br />

Following is the Verilog code for a 1-of-8 decoder.<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'b11111110;<br />

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

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

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

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

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

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

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

endcase<br />

end<br />

endmodule<br />

In the current version, XST does not infer decoders if one or several of<br />

the decoder outputs are not selected, except when the unused<br />

selector values are consecutive and at the end of the code space.<br />

Following is an example:<br />

IO pins Description<br />

s[2:0] Selector<br />

res Data Output<br />

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

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

Saved successfully!

Ooh no, something went wrong!