www.pudn.com > Haffman-encoding.rar > haff.v, change:2012-11-05,size:522b


module haff (in,out1);
    
input [2:0] in;
output reg [3:0] out1;
//reg [3:0] out1;
reg [3:0] o;
 
 always @(in)
 begin      
            if (in == 3'b000)begin o= 4'b0000; end 
       else if (in == 3'b001)begin o= 4'b0001; end 
       else if (in == 3'b010)begin o= 4'b0101; end 
       else if (in == 3'b011)begin o= 4'b0011; end 
       else if (in == 3'b100)begin o= 4'b0001; end 
       else if (in == 3'b101)begin o= 4'b0100; end 
       else if (in == 3'b110)begin o= 4'b0001; end 

 assign out1=o;
end
endmodule