- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I'm trying to synthesize and simulate a block described in BINR2time.vhd, it looks like its state is late by one nsimb strobe or something like that. I want state state machine to switch into 'attention' state just after getting a 00010000 byte, but it does it only after getting next byte. Why?
Quartus WE 10.0, Modelsim Altera 6.5, Linux.Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How is signal nsimb controlled in simulation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should look at the signal "state". It does not have an initial value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- You should look at the signal "state". It does not have an initial value. --- Quote End --- Yes it does. All types default to the left most value when uninitialised - which in this case is "idle"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nsimb is an input pin and its value is forced by simulator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the problem - its to do with the simmantics of the VHDL language.
Because you have set the clock and nsimb to rise and fall in unison (rather than have nsimb change with respect to the clock), the code actually sees nsimb as '1' when you see a rising edge on the wave window. If you look at the state signal, you will see it is changing at the same time as nsimb goes goes from 0=>1. The best way to fix this will be to do one of the following: 1. Have nsimb and in_c change on the falling edge of the clock 1. Write a testbench in VHDL and have nsimb react to the clock, rather than directly stimulate it and dont use the force command. So your code is working fine, your testing is not. Secondly, I found a bug in your code. Because wrt_counter is an integer 32 downto 0 and addr is only 15 downto 0, your simulation fails when you try to write 16+ to the address.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Yes it does. All types default to the left most value when uninitialised - which in this case is "idle" --- Quote End --- You are right for simulation, but I don't think this is guaranteed in all environments when you synthesize. I don't think the code is acceptable for an ASIC project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help! I'll try to continue developing now.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page