PCM_DECODER_TEST_5.v
`timescale 10ns/1ns
module PCM_DECODER_TEST_5;
reg clk;
reg rst;
reg din;
wire [7:0] dout;
wire D_en;
wire F_en;
parameter half_cycle = 10;
PCM_DECODER ut5(
.clk(clk),
.rst(rst),
.din(din),
.dout(dout),
.D_en(D_en),
.F_en(F_en)
);
initial begin
clk = 0;
forever begin
clk = # half_cycle ~ clk;
end
end
initial begin
rst = 1;
# (1 * half_cycle) rst = 0;
# (2 * half_cycle) rst = 1;
end
initial begin
din <= 0;
repeat (4) @ (posedge clk);
din <= 1;
repeat (16) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (160) @ (posedge clk);
din <= 1;
wave_10();
wave_11();
wave_01();
wave_01();
wave_11();
wave_11();
wave_10();
wave_01();
wave_10();
wave_10();
wave_11();
wave_01();
repeat (48) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (32) @ (posedge clk);
din <= 0;
repeat (20) @ (posedge clk);
$finish;
end
initial begin
$fsdbDumpfile("./verdiFsdb/PCM_DECODER_TEST_5.fsdb");
$fsdbDumpvars(0);
end
task wave_00();
repeat (16) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (128) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (16) @ (posedge clk);
din <= 1;
endtask
task wave_01();
repeat (16) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (96) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (48) @ (posedge clk);
din <= 1;
endtask
task wave_10();
repeat (48) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (96) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (16) @ (posedge clk);
din <= 1;
endtask
task wave_11();
repeat (48) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (64) @ (posedge clk);
din <= 0;
repeat (16) @ (posedge clk);
din <= 1;
repeat (48) @ (posedge clk);
din <= 1;
endtask
endmodule
Experiment Result