3_8译码器
真值表如下:
原理图如下:
端口命名如下:
代码如下:
`timescale 1ns / 1ps
//
//3—8译码器
//
module decoder3_8(
input a ,
input b ,
input c ,
output reg [7:0] out//由于输出数据 out 在 always 块中赋值,再将其定义为 reg 类型
);
always@(*)
begin
case({a,b,c})
3'b000 : out = 8'b0000_0001;
3'b001 : out = 8'b0000_0010;
3'b010 : out = 8'b0000_0100;
3'b011 : out = 8'b0000_1000;
3'b100 : out &