S
Sand Glass
Guest
ENVďźmodelsim 10.2c 32bit; debussy5.4; win7 x64 OS.
In the picture, blk_done_p have a glitch in red circle. I
Does the dangerous? If does, how to avoid?
`ifndef DLY
`define DLY 0
`endif
module test_glitch (
//Inputs
clk_bus, brst_n,
//Outputs
tile_done_p);
input clk_bus;//clock
input brst_n;//reset
output tile_done_p;
reg [1:0] cnt_h;
reg [3:0] cnt_w;
wire blk_done_p;
wire blky_row_done_p;
wire [1:0] enable;
wire frame_init_p;
assign frame_init_p = 1'b0;
assign enable[1:0] = 2'b11;
always @(posedge clk_bus or negedge brst_n) begin
if (!brst_n) begin
cnt_w <= #`DLY 4'd0;
end
else if (frame_init_p) begin
cnt_w <= #`DLY 4'd0;
end
else if(blky_row_done_p)begin
cnt_w <= #`DLY 4'd0;
end
else if(enable[0])begin
cnt_w <= #`DLY cnt_w + 1'b1;
end
end
always @(posedge clk_bus or negedge brst_n) begin
if (!brst_n) begin
cnt_h <= #`DLY 2'd0;
end
else if (frame_init_p) begin
cnt_h <= #`DLY 2'd0;
end
else if(blk_done_p)begin
cnt_h <= #`DLY 2'd0;
end
else if(blky_row_done_p)begin
cnt_h <= #`DLY cnt_h + 1'b1;
end
end
assign blky_row_done_p = enable[0] & (cnt_w == 15);
assign blk_done_p = blky_row_done_p & (cnt_h == 2'd3);
endmodule
////This is the sim.do script; flist.f have the test_glitch.v file.
//vlib work
//vlog -timescale "1ns/1ps" -f flist.f
//vsim work.tb_top
//run -all
//quit
In the picture, blk_done_p have a glitch in red circle. I
Does the dangerous? If does, how to avoid?
`ifndef DLY
`define DLY 0
`endif
module test_glitch (
//Inputs
clk_bus, brst_n,
//Outputs
tile_done_p);
input clk_bus;//clock
input brst_n;//reset
output tile_done_p;
reg [1:0] cnt_h;
reg [3:0] cnt_w;
wire blk_done_p;
wire blky_row_done_p;
wire [1:0] enable;
wire frame_init_p;
assign frame_init_p = 1'b0;
assign enable[1:0] = 2'b11;
always @(posedge clk_bus or negedge brst_n) begin
if (!brst_n) begin
cnt_w <= #`DLY 4'd0;
end
else if (frame_init_p) begin
cnt_w <= #`DLY 4'd0;
end
else if(blky_row_done_p)begin
cnt_w <= #`DLY 4'd0;
end
else if(enable[0])begin
cnt_w <= #`DLY cnt_w + 1'b1;
end
end
always @(posedge clk_bus or negedge brst_n) begin
if (!brst_n) begin
cnt_h <= #`DLY 2'd0;
end
else if (frame_init_p) begin
cnt_h <= #`DLY 2'd0;
end
else if(blk_done_p)begin
cnt_h <= #`DLY 2'd0;
end
else if(blky_row_done_p)begin
cnt_h <= #`DLY cnt_h + 1'b1;
end
end
assign blky_row_done_p = enable[0] & (cnt_w == 15);
assign blk_done_p = blky_row_done_p & (cnt_h == 2'd3);
endmodule
////This is the sim.do script; flist.f have the test_glitch.v file.
//vlib work
//vlog -timescale "1ns/1ps" -f flist.f
//vsim work.tb_top
//run -all
//quit