Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why read clk can't read out any data?

Status
Not open for further replies.

staraimm

Full Member level 2
Joined
Oct 21, 2006
Messages
133
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
2,178
hi, anybody, I wrote the verilog code as follows.

module test(inclk, inclr, indata, outclk, outclr, outdata);
input inclk, inclr, outclk, outclr;
input[7:0] indata;
output[7:0] outdata;

reg[7:0] mem[0:31];
reg[4:0] memcnt;

always @ (posedge inclk or negedge inclr)
begin
if(!inclr)
memcnt <= 0;
else
memcnt <= memcnt + 1;
end

always @ (posedge inclk)
begin
mem[memcnt] <= indata;
end

reg[4:0] rdcnt;

always @ (posedge outclk or negedge outclr)
begin
if(!outclr)
rdcnt <= 0;
else
rdcnt <= rdcnt + 1;
end

assign outdata = mem[rdcnt];

endmodule

Assume the inclk is about 15Mhz, and the outclk is about 10Mhz. I compiled the code with the QuartusII web version. But in the first 8 clock, I can't get the correct data on the bus. Can anybody tell me why? Thanks.
 

Can anyboday give me a answer?
 

Can you POST ur testbench for the code you have pasted??
 

I compile the code using the quartus. And I used the waveform not the testbench.
 

May be you can post the picture of ur waveforms then!
 

The waveform is attached. I want to know why the value between "02" and "04" is "00"? I think the value should be "03".
 

I agree with your "03" expectation. I don't see any obvious explanation. Maybe the synthesis didn't happen correctly, or maybe your simulator is broken.

What type FPGA/CPLD is this? Perhaps someone else can try it for you (I don't have Al.tera tools). It works fine in Xilinx. Here is a Spartan-3 post-route simulation.
 

    staraimm

    Points: 2
    Helpful Answer Positive Rating
I used the FPGA from Altera: EP1C12Q240C8. I tried serveral times, and found sometimes the result is good, but sometimes is not. Thank you very much.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top