Verilog编的8-3编码器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Verilog编的8-3编码器相关的知识,希望对你有一定的参考价值。
以下是我编的8-3编码器。请看下有什么问题吗module decoder(in,out,none_on);
input [7:0]in;
output [2:0]out;
output none_on;
reg [2:0]out;
none_on = 0;
always
begin
case(in)
10000000:
out = 111;
01000000:
out = 110;
00100000:
out = 101;
00010000:
out = 100;
00001000:
out = 011;
00000100:
out = 010;
00000010:
out = 001;
00000001:
out = 000;
default
out = 3'bz;
none_on = 1;
endcase
end
endmodule
input [7:0] in;
output [2:0] out;
output none_on;
reg [2:0] out; // code start
always begin
case(in)
10000000: out = 111;
01000000: out = 110;
00100000: out = 101;
00010000: out = 100;
00001000: out = 011;
00000100: out = 010;
00000010: out = 001;
00000001: out = 000;
default: out = 3'b0;
endcase none_on = 1;
end
endmodule 参考技术A 应该是付值写错了,要写成<=
以上是关于Verilog编的8-3编码器的主要内容,如果未能解决你的问题,请参考以下文章