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 : 18 ********************************************************************************/ 19 `timescale 1ns/1ps 20 `define UD #1 21 /*******************************************************************************/ 22 module ENCODE_8_3 23 ( 24 //Interface package 25 input [7:0] iDAT ,// 26 output reg [2:0] oCODE // 27 ); 28 //------------------------------------------------------------------------------- 29 always@(*)begin 30 case(iDAT) 31 8'h1 : oCODE = 3'h0; 32 8'h2 : oCODE = 3'h1; 33 8'h3 : oCODE = 3'h2; 34 8'h4 : oCODE = 3'h3; 35 8'h5 : oCODE = 3'h4; 36 8'h6 : oCODE = 3'h5; 37 8'h7 : oCODE = 3'h6; 38 8'h8 : oCODE = 3'h7; 39 default : oCODE = 3'hz; 40 endcase 41 end 42 //------------------------------------------------------------------------------- 43 endmodule