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
相关推荐
Rambo.xia4 小时前
接口协议避坑 · 第5篇:多器件级联时序踩坑实录
fpga开发
紫霄芯语10 小时前
观察者模式在FPGA中断系统的实战重构
观察者模式·fpga开发·重构
ARM+FPGA+AI工业主板定制专家1 天前
国产化RK3576+FPGA架构|晶圆传输机器人高速定位+AI瑕疵检测一体化方案
fpga开发·架构·机器人·嵌入式·fpga·工控·机器人运控
Eloudy2 天前
FPGA (QSFP28 + CMAC US+ RoCEv2) 与 Ubuntu22 + Mellanox 网卡直连分析
fpga开发
szxinmai主板定制专家2 天前
RK3568+FPGA高速并行采集|半导体探针测试设备多通道同步数据采集系统设计
人工智能·嵌入式硬件·计算机视觉·fpga开发
ARM|X86+FPGA工业主板厂家3 天前
RK3588+FPGA+EtherCAT异构架构解析|工业场景如何同时保住AI算力与微秒级运动实时性
人工智能·fpga开发·架构
zlinear数据采集卡3 天前
从“脏信号”到“纳伏级纯净”:硬核拆解DABL7606的多级抗混叠滤波与24位过采样算法
arm开发·科技·嵌入式硬件·fpga开发·开源
尤老师FPGA3 天前
HDMI数据的接收发送实验(二十)
fpga开发
千寻xun4 天前
三、实战篇-NVME SSD控制之FPGA实现(一)
fpga开发·nvme ssd·nvme协议
XMAIPC_Robot4 天前
软硬协同实时控制|RK3588业务调度+FPGA硬件时序,ethercat实现半导体设备微秒级响应(125us)
linux·arm开发·人工智能·fpga开发