问答题
16.采用行为描述方式,写出3-8译码器代码
【参考答案】
module three2eight(a,s);
input[2:0]a;
output[7:0]s;
reg[7:0]s;
always@(a)
begin
if(a==3'b000)
s<=8'b00000001;
else if(a==3'b001)
s<=8'b00000010;
else if(a==3'b010)
s<=8'b00000100;
else if(a==3'b011)
s<=8'b00001000;
else if(a==3'b100)
s<=8'b00010000;
else if(a==3'b101)
s<=8'b00100000;
else if(a==3'b110)
s<=8'b01000000;
else
s<=8'b10000000;
end
endmodule
点击查看答案
