//Convolutional Encoder for UMTS
//K = 9
//rate = 1/2
//
//Created by: Warrior Group
//
`resetall
//
module conv_encoder (conv_in, out0, out1, clk ,reset) ;

input clk, reset;
input conv_in ;
output out0, out1 ;

reg [7:0] tmp ;
reg tmp1, tmp2;

always @(posedge clk)
begin
  if (!reset)
    begin
      tmp = 8'b0;
    end
  else 
    begin 
      tmp1 = conv_in ^ tmp[1] ^ tmp[2] ^ tmp[3] ^ tmp[7] ;
      tmp2 = conv_in ^ tmp[0] ^ tmp[1] ^ tmp[2] ^ tmp[4]^ tmp[6] ^ tmp[7] ;
      tmp =  { tmp[6:0], conv_in };
    end
end 
assign out0 =  tmp1 ;
assign out1 =  tmp2 ;

endmodule
