每天进步一点点------基础实验_06_优先译码器 :优先译码器

 1  /*********************************************************************************
 2 * Company                    : 
 3 * Engineer                    : 空气微凉
 4 * 
 5 * Create Date                : 00:00:00 22/03/2013 
 6 * Design Name                : 
 7 * Module Name                :         
 8 * Project Name                :  
 9 * Target Devices            : 
10 * Tool versions            : 
11 * Description                :  
12 *                       http://www.cnblogs.com/kongqiweiliang/             
13 * Dependencies                : 
14 *
15 * Revision                    : 
16 * Revision                    : 0.01 - File Created
17 * Additional Comments    : 基础实验_06_优先译码器 :优先译码器 
18 ********************************************************************************/
19 `timescale 1ns/1ps
20 `define    UD  #1
21 /*******************************************************************************/
22 module DECODE_PRIORITY    
23 ( 
24     //Interface package
25     input                            [7:0]         iCODE    ,//50MHz
26     output  reg                    [7:0]         oDAT      //system interface
27 );  
28 //-------------------------------------------------------------------------------
29 always@(*)begin
30     if(iCODE[7])         oDAT = 8'b1000_0000;
31     else if(iCODE[6]) oDAT = 8'b0100_0000;
32     else if(iCODE[5]) oDAT = 8'b0010_0000;
33     else if(iCODE[4]) oDAT = 8'b0001_0000;
34     else if(iCODE[3]) oDAT = 8'b0000_1000;
35     else if(iCODE[2]) oDAT = 8'b0000_0100;
36     else if(iCODE[1]) oDAT = 8'b0000_0010;
37     else if(iCODE[0]) oDAT = 8'b0000_0001;
38     else                    oDAT = 8'bz;
39 end
40 //-------------------------------------------------------------------------------
41 endmodule 
原文地址:https://www.cnblogs.com/kongqiweiliang/p/3246415.html