?? 循環碼糾錯譯碼器.txt
字號:
循環碼糾錯譯碼器
module decoder2(c,y,clk);
output[6:0] c; //c 為輸出碼字,c[6]為高次項
input[6:0] y; //y 為接收碼字,y[6]為高次項
input clk;
reg[6:0] c,c_buf,buffer;
reg temp;
reg s0,s1,s2; //伴隨式電路寄存器
reg e; //錯誤檢測輸出信號
integer i;
always @(posedge clk)
begin
s0=0; s1=0; s2=0; //初始化
temp=0;
buffer=y; //接收碼字移入緩存
for (i=6;i>=0;i=i-1) //接收碼字進入除法電路
begin
e=s0&(~s1)&temp;
temp=s2;
s2=s1;
s1=s0^temp;
s0=y[i]^temp^e;
end
for (i=6;i>=0;i=i-1) //輸出糾錯譯碼后的碼字
begin
e=s0&(~s1)&temp;
temp=s2;
s2=s1;
s1=s0^temp;
s0=temp^e;
c_buf[i]=buffer[i]^e;
if (e==1) //若出錯,對緩存進行清零
begin
s0=0; s1=0; s2=0;
end
end
end
always @(posedge clk)
begin
c=c_buf;
end
endmodule
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -