(VHDL小程序002)用VHDL设计选择器

code如下:

entity mux2 is

     port(

          in1,in2:in bit_vector;

          ctrl:in bit;

          pout:out bit_vector

          );

end mux2;

 

architecture func of mux2 is

begin

     pout<=in1 when ctrl='1' else

               in2;

end func;

================================

多路选择可改变ctrl的位数,如8位的可用3位ctrl。

用并行when---else语句代替了process语句。

posted @ 2008-08-12 15:07  安达米特  阅读(493)  评论(0编辑  收藏  举报