哪位大神有FPGA的RS编码器的源程序呀

2019-07-15 23:55发布

基于FPGA的RS(15,11)编码器的实现,类似程序也行啊,。。。急需呀。。。给个呗
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
qaz123456321
2019-07-16 15:26
module frs(clk,rst_n,x,y
    );
         input    clk;
         
         input    rst_n;
         
         input   [3:0] x;
         
         output    [3:0] y;
         

parameter         idle=2'b00;
parameter              second=2'b01;
parameter         third=2'b10;
parameter                   forth=2'b11;
         
reg [1:0] state;

reg  [3:0] D1;
  // reg  [3:0]  x_in;
//reg [3:0] cnt;

always@(posedge clk  or negedge rst_n)
                                       begin
if(!rst_n)
begin
cnt<=4'b0000;
D1<=4'b1101;
state<=idle;
end
      else

                                 
case(state)

idle:
begin
D1[0]<=x[3]^D1[3];
D1[1]<=D1[0];
D1[2]<=D1[1]^x[3];
D1[3]<=D1[2]^x[3];
state<=second;
end



second:

begin
D1[0]<=x[2]^D1[3];
D1[1]<=D1[0];
D1[2]<=D1[1]^x[2];
D1[3]<=D1[2]^x[2];
state<=third;
end



third:
begin
D1[0]<=x[1]^D1[3];
D1[1]<=D1[0];
D1[2]<=D1[1]^x[1];
D1[3]<=D1[2]^x[1];
state<=forth;
end


forth:
begin
D1[0]<=x[0]^D1[3];
D1[1]<=D1[0];
D1[2]<=D1[1]^x[0];
D1[3]<=D1[2]^x[0];
end
default:state<=idle;





endcase


                                       end

         
        assign y=D1;
         
         


endmodule  


一周热门 更多>