L
lei
Guest
Hi All:
I just started learning Verilog, I am using xilinx ISE 9.2i for my
development. The following is a piece of code that I copied mostly
(from fpga4fun).
module led(clk_in, clk_out, data_in);
input clk_in;
output clk_out;
input [12:0] data_in;
reg clk_out;
parameter INPUT_CLK = 50000000; //input clock is 50mhz
parameter OUTPUT_CLK = 60; //60hz to refresh the LED.
parameter CLK_ACC_INC_WIDTH = 20; //Use 20 bit accumulater.
parameter CLK_ACC_INC = (OUTPUT_CLK << CLK_ACC_INC_WIDTH) /
INPUT_CLK;
reg [CLK_ACC_INC_WIDTH:0] clk_acc;
initial
begin
clk_acc = 0;
clk_out = 0;
end
always @(posedge clk_in)
begin
clk_acc = clk_acc[19:0] + CLK_ACC_INC;
clk_out = clk_acc[20];
end
endmodule
The code passed synthesis step, but after i created test bench
waveform and run the simulation, it either:
1. clk_in is Z, so everything is straight line, basically means no
clock .
2. clk_in appears to be right, but the clk_acc is not being
accumulated.
Can anybody shed some lights on me ? what is going on with ISE? why
clk_in is not being driven?
I've been trying various step for 2 days , and can't figure out what's
the problem.
Appreciate your help.
Thank you!
lei
I just started learning Verilog, I am using xilinx ISE 9.2i for my
development. The following is a piece of code that I copied mostly
(from fpga4fun).
module led(clk_in, clk_out, data_in);
input clk_in;
output clk_out;
input [12:0] data_in;
reg clk_out;
parameter INPUT_CLK = 50000000; //input clock is 50mhz
parameter OUTPUT_CLK = 60; //60hz to refresh the LED.
parameter CLK_ACC_INC_WIDTH = 20; //Use 20 bit accumulater.
parameter CLK_ACC_INC = (OUTPUT_CLK << CLK_ACC_INC_WIDTH) /
INPUT_CLK;
reg [CLK_ACC_INC_WIDTH:0] clk_acc;
initial
begin
clk_acc = 0;
clk_out = 0;
end
always @(posedge clk_in)
begin
clk_acc = clk_acc[19:0] + CLK_ACC_INC;
clk_out = clk_acc[20];
end
endmodule
The code passed synthesis step, but after i created test bench
waveform and run the simulation, it either:
1. clk_in is Z, so everything is straight line, basically means no
clock .
2. clk_in appears to be right, but the clk_acc is not being
accumulated.
Can anybody shed some lights on me ? what is going on with ISE? why
clk_in is not being driven?
I've been trying various step for 2 days , and can't figure out what's
the problem.
Appreciate your help.
Thank you!
lei