-
Notifications
You must be signed in to change notification settings - Fork 149
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
Bluesim VCD for mkLFIFO has wrong FULL_N value #519
Comments
It is worth mentioning that the function that needs fixing is |
I would like to take up this issue... |
Awesome! Thank you! The file to look at is
The type is an enum declared at the top of the file:
You'll notice that there are a lot of files named You'll see that the class has member functions The Inside the Only changes in value need to be dumped, so there is a struct called
You'll notice that this code is calling FYI, to see where the Looking at how It may be that the VCD dumping should be calling However, I notice that Does that help? Maybe this is a little more buggy than I thought, and a little more complicated to fix. I'd start first by making examples of these situations and checking what is working. I'm happy to offer advice as you go. An eventual PR will also need to add testcases. There's some info on that in the |
Hey @quark17 |
As reported on the
b-lang-discuss
mailing list, for the BSV code below, the VCD file generated when simulating with Bluesim has a different value for theFULL_N
port of themkLFIFO
module than the VCD from Verilog simulation.At a clock edge, Bluesim steps through all the rules that are schedule to fire, executing them in order. Thus, Bluesim is able to see the state of the system at all the micro-steps that happen: a FIFO may start full (
FULL_N
is False), then a rule dequeues from the FIFO (FULL_N
becomes True), and then another rule enqueues into the FIFO (FULL_N
becomes False again). For someone debugging a design, it could be useful to see all of these values. However, we have chosen that Bluesim VCDs should match the VCDs generated from Verilog simulation. The Verilog is simulating closer to what happens in the hardware: after the clock edge, the signals settle down into one value, which is latched at the next edge. For typical submodules, the values represent the view of the state at the start of the clock cycle; however, for "loopy" modules (likemkLFIFO
), the values are the ones seen at some later micro-step. Thus, in the Verilog simulation,FULL_N
has the value after the first rule has executed (whenFULL_N
goes to True) and not the value at the start or end of the execution. Bluesim should generate a VCD file that matches this behavior of Verilog.This bug is only in the dumping of the VCD; the behavior of the Bluesim simulation is correct. In Bluesim, there is a C++ class for modules, which has functions for executing rules and methods, and separately it has a function to dump the VCD -- a function which is called at the end of the execution of all rules at a clock edge. Here, it's just that dump function which is buggy. And this is because Bluesim shares one C++ class for all FIFO modules. When instantiated, the constructor has arguments that specify which of the many FIFOs that instance should be. One is for "loopy" behavior. In the VCD dump function, there are if-else statements to pick how to dump the VCD depending on the type of FIFO, but it is missing if-statements that check for loopy. We should fix that and also add a test case.
Here is the example that illustrates the difference:
The text was updated successfully, but these errors were encountered: