Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~phil/hardware/pdev/fpga/gx/sp/test/gx_dump.v
Дата изменения: Thu Jun 26 04:27:55 2008
Дата индексирования: Sat Sep 6 20:01:33 2008
Кодировка:

Поисковые слова: п п п п п п п п п п п п п п п п п п п

// Jeff Mock
// 2030 Gough St.
// San Francisco, CA 94109
// jeff@mock.com
//
// Copyright 2005,2006
//
// $URL: https://www.mock.com/svn/pdev/trunk/gx/sp/test/gx_dump.v $
// $Id: gx_dump.v 232 2006-06-25 23:15:13Z jeff $


`ifdef DUMP_PACK
// Dump output of pack unit before getting put into the
// external sram fifo (pack_fifo).
//
integer fdp;
integer p_width;
integer p_idx;
integer p_acc;
initial begin
@ (posedge running) ;
p_width = 1;
case (sim_fmtwid)
0: p_width = 8;
1: p_width = 16;
2: p_width = 32;
endcase
fdp = $fopen("pack.out");
$fdisplay(fdp, "PACK %d %d %d %d %d", sim_len, p_width,
sim_fmttype, sim_dumpstart, sim_dumpstop);
p_idx = 0;
p_acc = 0;
end
always @(posedge ck) begin
if (top.gx.pack_vld) begin
if (p_idx == 0)
$fdisplay(fdp, "");
$fdisplay(fdp, "%d %x", p_idx, top.gx.pack_dat);
p_idx = p_idx + 1;
end
if (p_idx == sz_bpi/8) begin
p_idx = 0;
$display("acc %d", p_acc);
p_acc = p_acc + 1;
end
end
`endif

`ifdef DUMP_ACC
// Dump output of the accumulators before getting packed.
//
integer fd;
integer repcnt;
integer cmp;
integer mcnt;
reg [13:0] rcnt;
reg cap;
reg capgo;

reg [`N_ACC-1:0] st_x_s0 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_x_s1 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_x_s2 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_x_s3 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_y_s0 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_y_s1 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_y_s2 [0:`N_MAX/2 - 1];
reg [`N_ACC-1:0] st_y_s3 [0:`N_MAX/2 - 1];
initial begin
fd = $fopen("acc.out");
mcnt = 0;
cap = 0;
repcnt = 0;
cmp = 0;
capgo = 0;
end
always @(posedge ck) begin
if (top.gx.sp.sync_acc) begin
rcnt=0;
if (top.gx.sp.accdump) begin
cap=1;
capgo=1;
repcnt=0;
$fdisplay(fd, "");
end else if (capgo) begin
repcnt=repcnt+1;
cmp = (repcnt < sim_dcnt*2+2);
if (repcnt == sim_dcnt*2+2)
mcnt = mcnt+1;
cap=0;
end
end

if (cap) begin
st_x_s0[rcnt] = top.gx.sp.x_acc_s0;
st_x_s1[rcnt] = top.gx.sp.x_acc_s1;
st_x_s2[rcnt] = top.gx.sp.x_acc_s2;
st_x_s3[rcnt] = top.gx.sp.x_acc_s3;
st_y_s0[rcnt] = top.gx.sp.y_acc_s0;
st_y_s1[rcnt] = top.gx.sp.y_acc_s1;
st_y_s2[rcnt] = top.gx.sp.y_acc_s2;
st_y_s3[rcnt] = top.gx.sp.y_acc_s3;
$fdisplay(fd, " %d %x %x %x %x %x %x %x %x", rcnt,
top.gx.sp.x_acc_s0, top.gx.sp.x_acc_s1,
top.gx.sp.x_acc_s2, top.gx.sp.x_acc_s3,
top.gx.sp.y_acc_s0, top.gx.sp.y_acc_s1,
top.gx.sp.y_acc_s2, top.gx.sp.y_acc_s3);
rcnt = rcnt + 1;
end

if (cmp) begin
if (
st_x_s0[rcnt] != top.gx.sp.x_acc_s0 ||
st_x_s1[rcnt] != top.gx.sp.x_acc_s1 ||
st_x_s2[rcnt] != top.gx.sp.x_acc_s2 ||
st_x_s3[rcnt] != top.gx.sp.x_acc_s3 ||
st_y_s0[rcnt] != top.gx.sp.y_acc_s0 ||
st_y_s1[rcnt] != top.gx.sp.y_acc_s1 ||
st_y_s2[rcnt] != top.gx.sp.y_acc_s2 ||
st_y_s3[rcnt] != top.gx.sp.y_acc_s3) begin
$display("Dump miscompare mcnt=%d repcnt=%d",
mcnt, repcnt, rcnt);
$display(" %d %x %x %x %x %x %x %x %x", rcnt,
top.gx.sp.x_acc_s0, top.gx.sp.x_acc_s1,
top.gx.sp.x_acc_s2, top.gx.sp.x_acc_s3,
top.gx.sp.y_acc_s0, top.gx.sp.y_acc_s1,
top.gx.sp.y_acc_s2, top.gx.sp.y_acc_s3);
$display(" %d %x %x %x %x %x %x %x %x", rcnt,
st_x_s0[rcnt], st_x_s1[rcnt],
st_x_s2[rcnt], st_x_s3[rcnt],
st_y_s0[rcnt], st_y_s1[rcnt],
st_y_s2[rcnt], st_y_s3[rcnt] );
end
rcnt = rcnt + 1;
end
end
`endif

`ifdef DUMP_STOKES
// Dump output of stokes block before accumulation
//

integer ds_rcnt;
integer ds_dsfp;
reg ds_cap;

initial begin
ds_cap = 1'b0;
ds_dsfp = $fopen("stokes.out");
end
always @(posedge ck) begin
if (top.gx.sp.sync_stokes) begin
ds_cap = 1'b1;
ds_rcnt = 0;
$fdisplay(ds_dsfp, "");
end
if (ds_cap) begin
$fdisplay(ds_dsfp, " %d %x %x %x %x %x %x %x %x",
ds_rcnt,
top.gx.sp.x_s0, top.gx.sp.x_s1, top.gx.sp.x_s2, top.gx.sp.x_s3,
top.gx.sp.y_s0, top.gx.sp.y_s1, top.gx.sp.y_s2, top.gx.sp.y_s3);
if ( top.gx.sp.x_s0[`N_MUL-1] | top.gx.sp.x_s1[`N_MUL-1] |
top.gx.sp.y_s0[`N_MUL-1] | top.gx.sp.y_s1[`N_MUL-1])
$fdisplay(ds_dsfp, " NEG");
ds_rcnt = ds_rcnt + 1;
if (ds_rcnt == top.gx.sp.creg_len/2)
ds_cap = 1'b0;
end
end
`endif

`ifdef DUMP_PFOX
// Dump output of the external sram FIFO before it goes to
// the pi_fifo and the power_pc interface.
//

integer vld_cnt;
integer pfo_fd;
integer pfo_width;
integer pfo_acc;
reg [63:0] pfo_reg;


initial begin
pfo_acc = 0;
pfo_fd = $fopen("pfox.out");
vld_cnt = 0;
@(posedge running) ;
pfo_width = 1;
case (sim_fmtwid)
0: pfo_width = 8;
1: pfo_width = 16;
2: pfo_width = 32;
endcase
$fdisplay(pfo_fd, "PACK %d %d %d %d %d",
sim_len,
pfo_width,
sim_fmttype,
sim_dumpstart,
sim_dumpstop);
end
always @(posedge ck) begin
if (~reset & top.gx.pi.pfox_vld) begin
if (vld_cnt == 0)
$fdisplay(pfo_fd, "");
if (vld_cnt & 1) begin
pfo_reg[31:0] = top.gx.pi.pfox_dat;
$fdisplay(pfo_fd, "%d %x", (vld_cnt-1)/2, pfo_reg);
end else
pfo_reg[63:32] = top.gx.pi.pfox_dat;
vld_cnt = vld_cnt + 1;
if (vld_cnt == sz_bpi/4) begin
vld_cnt = 0;
pfo_acc = pfo_acc + 1;
end
end
end
`endif