Encoder.sv

Go to the documentation of this file.
00001 
00032 // This is an encoder, but it is not really used in the example. Just another file.
00033 module Encoder(
00034 output logic  [3:0]  result ,  
00035 input  logic [15:0]  in ,   
00036 input  logic         enable        
00037 );
00038 
00041 always_comb begin: encoder_comb
00042   result = 0;
00043   if (enable) begin
00044     case (in) 
00045       16'h0001 : result = 1; 
00046       16'h0002 : result = 2; 
00047       16'h0003 : result = 3; 
00048       16'h0004 : result = 4;
00049       16'h0005 : result = 5; 
00050       16'h0006 : result = 6; 
00051       16'h0007 : result = 7; 
00052       16'h0008 : result = 8;
00053       16'h0009 : result = 9;
00054       16'h0010 : result = 10; 
00055       16'h0011 : result = 11; 
00056       16'h0012 : result = 12; 
00057       16'h0013 : result = 13; 
00058       16'h0014 : result = 14; 
00059       16'h0015 : result = 15; 
00060    endcase
00061   end
00062 end : encoder_comb
00063 
00064 endmodule
00065 

Generated on Thu Aug 14 17:17:31 2008 for ExampleProjects by  doxygen 1.5.2-SystemVerilog-20080806