VL15 优先编码器Ⅰ

两种思路

timescale 复制代码
module encoder_83(
   input      [7:0]       I   ,
   input                  EI  ,
   
   output wire [2:0]      Y   ,
   output wire            GS  ,
   output wire            EO    
);

reg [4:0] temp1 ;
always @(*) begin
    casex({EI,I}) 
        9'b0_xxxx_xxxx:begin temp1 = 5'b000_0_0;end
        9'b1_0000_0000:begin temp1 = 5'b000_0_1;end
        9'b1_1xxx_xxxx:begin temp1 = 5'b111_1_0;end
        9'b1_01xx_xxxx:begin temp1 = 5'b110_1_0;end
        9'b1_001x_xxxx:begin temp1 = 5'b101_1_0;end
        9'b1_0001_xxxx:begin temp1 = 5'b100_1_0;end
        9'b1_0000_1xxx:begin temp1 = 5'b011_1_0;end
        9'b1_0000_01xx:begin temp1 = 5'b010_1_0;end
        9'b1_0000_001x:begin temp1 = 5'b001_1_0;end
        9'b1_0000_0001:begin temp1 = 5'b000_1_0;end
    endcase
end

assign {Y,GS,EO} =temp1;
//    assign Y[0] =  EI & (I[7] | ~I[6]&I[5] | ~I[6]&~I[4]&I[3] | ~I[6]&~I[4]&~I[2]&I[1]);
//    assign Y[1] =  EI & (I[7] | I[6] | ~I[5]&~I[4]&I[3] | ~I[5]&~I[4]&I[2]);
//    assign Y[2] =  EI && (I[4] | I[5] | I[6] | I[7]) ;

//    assign GS = EI && (I[0] | I[1] | I[2] | I[3]| I[4]| I[5]| I[6]| I[7])  ;
//    assign EO =  EI && ~(I[0] | I[1] | I[2] | I[3]| I[4]| I[5]| I[6]| I[7])   ;





endmodule
timescale 复制代码
module encoder_83(
   input      [7:0]       I   ,
   input                  EI  ,
   
   output wire [2:0]      Y   ,
   output wire            GS  ,
   output wire            EO    
);

//reg [4:0] temp1 ;
//always @(*) begin
//    casex({EI,I}) 
//        9'b0_xxxx_xxxx:begin temp1 = 5'b000_0_0;end
//        9'b1_0000_0000:begin temp1 = 5'b000_0_1;end
//        9'b1_1xxx_xxxx:begin temp1 = 5'b111_1_0;end
//        9'b1_01xx_xxxx:begin temp1 = 5'b110_1_0;end
//        9'b1_001x_xxxx:begin temp1 = 5'b101_1_0;end
//        9'b1_0001_xxxx:begin temp1 = 5'b100_1_0;end
//        9'b1_0000_1xxx:begin temp1 = 5'b011_1_0;end
//        9'b1_0000_01xx:begin temp1 = 5'b010_1_0;end
//        9'b1_0000_001x:begin temp1 = 5'b001_1_0;end
//        9'b1_0000_0001:begin temp1 = 5'b000_1_0;end
//    endcase
//end

//assign {Y,GS,EO} =temp1;

    assign Y[0] =  EI & (I[7] | ~I[6]&I[5] | ~I[6]&~I[4]&I[3] | ~I[6]&~I[4]&~I[2]&I[1]);
    assign Y[1] =  EI & (I[7] | I[6] | ~I[5]&~I[4]&I[3] | ~I[5]&~I[4]&I[2]);
    assign Y[2] =  EI && (I[4] | I[5] | I[6] | I[7]) ;

    assign GS = EI && (I[0] | I[1] | I[2] | I[3]| I[4]| I[5]| I[6]| I[7])  ;
    assign EO =  EI && ~(I[0] | I[1] | I[2] | I[3]| I[4]| I[5]| I[6]| I[7])   ;





endmodule
相关推荐
Zoolybo4 小时前
FPGA| 使用Quartus II报错Top-level design entity ““ is undefined
fpga开发
FakeOccupational9 小时前
fpga系列 HDL:XILINX Vivado Vitis 高层次综合(HLS) 实现 EBAZ板LED控制(上)
fpga开发
云山工作室14 小时前
基于fpga技术的脉冲信号源设计(论文+源码)
stm32·嵌入式硬件·fpga开发·毕业设计·毕设
Terasic友晶科技1 天前
第26篇 基于ARM A9处理器用C语言实现中断<二>
c语言·fpga开发·中断·de1-soc开发板
Zoolybo1 天前
FPGA|安装USB Blaster驱动
fpga开发
我爱C编程2 天前
【硬件测试】基于FPGA的QPSK+帧同步系统开发与硬件片内测试,包含高斯信道,误码统计,可设置SNR
fpga开发·qpsk·帧同步·硬件片内测试·高斯信道
Zoolybo2 天前
FPGA|使用quartus II通过AS下载POF固件
fpga开发
水饺编程4 天前
简易CPU设计入门:控制总线的剩余信号(四)
linux·嵌入式硬件·fpga开发·硬件工程
mcupro4 天前
从AD的原理图自动提取引脚网络的小工具
fpga开发
cckkppll5 天前
FPGA 使用 CLOCK_DEDICATED_ROUTE 约束
fpga开发