D
Daku
Guest
Could some Verilog guru please help ? I have a serial parallel
converter that is works as follows:
1. there is no clock, and the input is a serial stream of 1s and
zeros, at a given rate. A second input indicates if the data is valid
(true) or invalid(false).
2. I divide the serial input into 64 a bit array, using the
concatenation operator, and then use a fork - join block to sub-divide
this into 8 8-bit sub-arrays, in parallel
3. I am using Icarus Verilog 0.9.1
However, the output shows that each of the 8-bit sub-arrays contain
0xFF. My source code is given below :
`timescale 10ns/1ns
module rs(pls_data_req,
pls_data_req_incomplete,
txd0,
txd1,
txd2,
txd3,
txd4,
txd5,
txd6,
txd7, txc);
/* txc, tx_clk); */
parameter MAX = 64;
parameter BYTE_SIZE = 8;
parameter BLANK64 =
64'b0000000000000000000000000000000000000000000000000000000000000000;
parameter BLANK8 = 8'b00000000;
input pls_data_req;
input pls_data_req_incomplete;
output [7:0] txd0;
output [7:0] txd1;
output [7:0] txd2;
output [7:0] txd3;
output [7:0] txd4;
output [7:0] txd5;
output [7:0] txd6;
output [7:0] txd7;
output [7:0] txc;
/*
output tx_clk;
*/
integer count;
integer ochnlnum;
reg [63:0] txd;
reg [7:0] txc;
reg [7:0] txd0;
reg [7:0] txd1;
reg [7:0] txd2;
reg [7:0] txd3;
reg [7:0] txd4;
reg [7:0] txd5;
reg [7:0] txd6;
reg [7:0] txd7;
initial
begin
/*
tx_clk = 1b'1;
*/
txd = BLANK64;
txc = 8'b11111111;
count = 0;
ochnlnum = 0;
end
always
#2
begin
if(pls_data_req_incomplete == 1'b1)
begin
for(count = MAX; count > 0; count = count - 1)
begin
txd = {txd[62:0], pls_data_req};
end
fork
assign txd0 = txd[7:0];
assign txd1 = txd[15:8];
assign txd2 = txd[23:16];
assign txd3 = txd[31:24];
assign txd4 = txd[39:32];
assign txd5 = txd[47:40];
assign txd6 = txd[55:48];
assign txd7 = txd[63:56];
join
txd = BLANK64;
$display("txd0=%g txd1=%g txd2=%g txd3=%g txd4=%g",
txd0, txd1, txd2, txd3, txd4);
txd0 = BLANK8;
txd1 = BLANK8;
txd2 = BLANK8;
txd3 = BLANK8;
txd4 = BLANK8;
txd5 = BLANK8;
txd6 = BLANK8;
txd7 = BLANK8;
end
end
endmodule
Any hints, suggestions about what might be going wrong would be
invaluable - I suspect the concatenation step is not working right.
Thanks in advance.
converter that is works as follows:
1. there is no clock, and the input is a serial stream of 1s and
zeros, at a given rate. A second input indicates if the data is valid
(true) or invalid(false).
2. I divide the serial input into 64 a bit array, using the
concatenation operator, and then use a fork - join block to sub-divide
this into 8 8-bit sub-arrays, in parallel
3. I am using Icarus Verilog 0.9.1
However, the output shows that each of the 8-bit sub-arrays contain
0xFF. My source code is given below :
`timescale 10ns/1ns
module rs(pls_data_req,
pls_data_req_incomplete,
txd0,
txd1,
txd2,
txd3,
txd4,
txd5,
txd6,
txd7, txc);
/* txc, tx_clk); */
parameter MAX = 64;
parameter BYTE_SIZE = 8;
parameter BLANK64 =
64'b0000000000000000000000000000000000000000000000000000000000000000;
parameter BLANK8 = 8'b00000000;
input pls_data_req;
input pls_data_req_incomplete;
output [7:0] txd0;
output [7:0] txd1;
output [7:0] txd2;
output [7:0] txd3;
output [7:0] txd4;
output [7:0] txd5;
output [7:0] txd6;
output [7:0] txd7;
output [7:0] txc;
/*
output tx_clk;
*/
integer count;
integer ochnlnum;
reg [63:0] txd;
reg [7:0] txc;
reg [7:0] txd0;
reg [7:0] txd1;
reg [7:0] txd2;
reg [7:0] txd3;
reg [7:0] txd4;
reg [7:0] txd5;
reg [7:0] txd6;
reg [7:0] txd7;
initial
begin
/*
tx_clk = 1b'1;
*/
txd = BLANK64;
txc = 8'b11111111;
count = 0;
ochnlnum = 0;
end
always
#2
begin
if(pls_data_req_incomplete == 1'b1)
begin
for(count = MAX; count > 0; count = count - 1)
begin
txd = {txd[62:0], pls_data_req};
end
fork
assign txd0 = txd[7:0];
assign txd1 = txd[15:8];
assign txd2 = txd[23:16];
assign txd3 = txd[31:24];
assign txd4 = txd[39:32];
assign txd5 = txd[47:40];
assign txd6 = txd[55:48];
assign txd7 = txd[63:56];
join
txd = BLANK64;
$display("txd0=%g txd1=%g txd2=%g txd3=%g txd4=%g",
txd0, txd1, txd2, txd3, txd4);
txd0 = BLANK8;
txd1 = BLANK8;
txd2 = BLANK8;
txd3 = BLANK8;
txd4 = BLANK8;
txd5 = BLANK8;
txd6 = BLANK8;
txd7 = BLANK8;
end
end
endmodule
Any hints, suggestions about what might be going wrong would be
invaluable - I suspect the concatenation step is not working right.
Thanks in advance.