0%

数字电路

学习笔记:

2-4译码器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module decoder_2_4(a, en, y):
input [1:0] a;
input en;
output reg[3:0] y;

always @ *
begin
if (~en) // 不使能
begin
y = 4'b0000;
end
else
begin // enable
if(a==2'b00)
begin
y = 4'b0001;
end
else
begin
if (a==b'10)
end
else
begin
y=


end
endmodule
  • 1’b0中‘前面的数字表示位数,后面的b表示数据类型(进制),表示一位二进制数0
  • en == 1’b0可以用en来替代。
  • 5f31c6