Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thanks for help #6

Closed
simdream opened this issue Feb 14, 2020 · 1 comment
Closed

thanks for help #6

simdream opened this issue Feb 14, 2020 · 1 comment

Comments

@simdream
Copy link

I am taking zipCPU as an example to learn how to make Verilator used in my project.

From testb.cpp, I noticed you are use one extra eval() before posedge clock:

            // Pre-evaluate, to give verilator a chance
	// to settle any combinatorial logic that
	// that may have changed since the last clock
	// evaluation, and then record that in the
	// trace.
	eval();

But if this is a synchronous design, should the eval() following clock wagging updated the comb logic also? To add one more eval() here might also slow down the run time performance?

Many thanks,

@ZipCPU
Copy link
Owner

ZipCPU commented Feb 14, 2020

Does this slow down run time performance? Yes.

I discuss this problem somewhat in lesson 4 of my tutorial.

Here's the issue: between calls to tick(), the C++ hardware emulators might change input ports. A classic example of this would be the serial port simulation line, or even the SD Card emulator. Verilator needs to be told that these values may have changed outside of its view of the world before adjusting things lest the trace ... not make sense. As it is, because these values are shown to be adjusted just before the clock tick, you might argue that the trace doesn't make sense anyway, but this is the best I've been able to do in order to keep things consistent between the emulated and the simulated environments.

@ZipCPU ZipCPU closed this as completed Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants