|
这个是基于VHDL用循环码编译码器的课程设计···
杯具···没学过VHDL···时间短,只能求教于各位高手们了···网上的资料也不全···泪奔···别人都开始写报告了···我连程序这关都还没搞定···抽到个不给力的题目只能怪曾哥不保佑哈····各位能帮我转下就转吧···帮我调试下哦··· 有好材料就直接发给我吧··我邮箱是 ling2323@qq.com
谢谢各位,麻烦各位了···
程序如下···
(7,4)循环码编码部分:
module cycle(c,u,clk);
output[6:0] c;
input[3:0] u;
input clk;
reg[2:0] i;
reg d0,d1,d2,temp;
reg[6:0] c;
always @(posedge clk)
begin
d0=0; d1=0; d2=0;
for (i=0;i<4;i=i+1)
begin
c=u;
temp = d2 ^ c;
d2 = d1; d1 = d0 ^ temp;
d0 = temp;
end
for (i=4;i<7;i=i+1)
begin
c = d2;
d2 = d1; d1 = d0;
d0 = 0;
end
end
endmodule
纠错和译码部分
module decoder(c,y,clk);
output[6:0]c;
input[6:0]y;
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^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=buffer^e;
if(e==1)
begin
s0=0; s1=0; s2=0;
end
end
end
always@(posedge clk)
begin
c=c_buf;
end
endmodule |
|