题解 | 优先编码器Ⅰ

优先编码器Ⅰ

https://www.nowcoder.com/practice/a7068b8f4c824d6a9592f691990b21de

`timescale 1ns/1ns

module encoder_83(
   input      [7:0]       I   ,
   input                  EI  ,
   
   output reg [2:0]      Y   ,
   output reg            GS  ,
   output reg            EO    
);

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

endmodule

全部评论

相关推荐

阿武同学:基本信息保留前面三行,其他的可以全部删掉,邮箱最重要的你没写,主修课程精简到8个以内,实习里面2/3/4都是水内容的,非要写的话建议两到三句话,项目经历排版优化下,自我评价缩到三行
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务