electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Why read clk can't read out any data?


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Why read clk can't read out any data?
Author Message
staraimm



Joined: 21 Oct 2006
Posts: 134
Helped: 3


Post07 Dec 2006 9:22   

Why read clk can't read out any data?


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.
Back to top
staraimm



Joined: 21 Oct 2006
Posts: 134
Helped: 3


Post08 Dec 2006 1:36   

Re: Why read clk can't read out any data?


Can anyboday give me a answer?
Back to top
Google
AdSense
Google Adsense




Post08 Dec 2006 1:36   

Ads




Back to top
nand_gates



Joined: 19 Jul 2004
Posts: 907
Helped: 120


Post08 Dec 2006 5:06   

Re: Why read clk can't read out any data?


Can you POST ur testbench for the code you have pasted??
Back to top
staraimm



Joined: 21 Oct 2006
Posts: 134
Helped: 3


Post08 Dec 2006 7:30   

Re: Why read clk can't read out any data?


I compile the code using the qu(at)rtus. And I used the waveform not the testbench.
Back to top
nand_gates



Joined: 19 Jul 2004
Posts: 907
Helped: 120


Post08 Dec 2006 9:05   

Re: Why read clk can't read out any data?


May be you can post the picture of ur waveforms then!
Back to top
staraimm



Joined: 21 Oct 2006
Posts: 134
Helped: 3


Post08 Dec 2006 10:59   

Re: Why read clk can't read out any data?


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


Sorry, but you need login in to view this attachment

Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post08 Dec 2006 15:04   

Re: Why read clk can't read out any data?


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.



Sorry, but you need login in to view this attachment

Back to top
staraimm



Joined: 21 Oct 2006
Posts: 134
Helped: 3


Post09 Dec 2006 1:35   

Re: Why read clk can't read out any data?


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.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Why read clk can't read out any data?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
How to read\write data using asynchronous clk? (9)
why my c-compiler can't read my cod? (3)
How can we read data from any microcontroller or Flash ? (1)
Read clk> wr_clk (1)
Can't read compass (5)
RESISTORS CAN'T READ COLORS (10)
LED read-out assistance (4)
How to read out MMC/SD card root directory? (1)
Need 0-12v d.c POWER supply DESIGN with digital read out. (2)
why AD7705 only read 1 chanel!!! (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS