卷积编码器---Verilog代码


卷积编码器---Verilog代码

module conv_encoder(

    input      wire             clk,
    input      wire             aclr,
    input      wire             data_in,
    input      wire             nd,
    output     reg   [1:0]      data_out_v,
    output     reg              rdy
    );


reg [6:1] shift_reg;

always @ ( negedge aclr or posedge clk )
begin
    if(!aclr)
    begin
        shift_reg <= 6'b000000;
        data_out_v <= 0;
        rdy <= 0;
    end
    else 
    begin
        if(nd)
        begin
            data_out_v[0] <= shift_reg[6] + shift_reg[5] + shift_reg[3] + shift_reg[2] + data_in;
            data_out_v[1] <= shift_reg[6] + shift_reg[3] + shift_reg[2] + shift_reg[1] + data_in;
            rdy<=1;
            shift_reg <= { shift_reg [5:1], data_in };
        end
        else 
        begin
            rdy <= 0;
        end
    end
end


endmodule

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM