zoomkrupesh
Newbie level 4
Hi,
I am facing a problem in computing division of two polynomial.I am using lfsr for the equation x^4+x+1.And my input is x^8+1.What should be my output?i.e if I divide x^8+1 by x^4+x+1.Below I have given a code for generating equation x^4+x+1
module s1(clk,rst,data_in,s1);
input data_in;
output [3:0] s1;
input rst;
input clk;
reg [3:0] s1;
always @(posedge clk or posedge rst)
begin
if(rst)
begin
s1 <= 4'b0000;
end
else
begin
s1[0] <= s1[3] ^ data_in;
s1[1] <= s1[0] ^ s1[3] ^ data_in;
s1[2] <= s1[1];
s1[3] <= s1[2];
end
end
endmodule
I applied vector 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 serially to above verilog code.But I am not getting the correct output.
Please help me
Thanks in advance
I am facing a problem in computing division of two polynomial.I am using lfsr for the equation x^4+x+1.And my input is x^8+1.What should be my output?i.e if I divide x^8+1 by x^4+x+1.Below I have given a code for generating equation x^4+x+1
module s1(clk,rst,data_in,s1);
input data_in;
output [3:0] s1;
input rst;
input clk;
reg [3:0] s1;
always @(posedge clk or posedge rst)
begin
if(rst)
begin
s1 <= 4'b0000;
end
else
begin
s1[0] <= s1[3] ^ data_in;
s1[1] <= s1[0] ^ s1[3] ^ data_in;
s1[2] <= s1[1];
s1[3] <= s1[2];
end
end
endmodule
I applied vector 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 serially to above verilog code.But I am not getting the correct output.
Please help me
Thanks in advance