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
Statement queue pop_front error after foreach #1641
Comments
Original Redmine Comment Hi, from a very rough look at it, it seems that it does not like @queue.pop_front@ as standalone statement, but only in an assignment (using its return and not (void) usage): V3Width.cpp:2044-2053. This is at least a workaround, but I believe it is allowed to use it that way, right? Wilson, happy to solve that, its a part of the code I am eager to learn more about. Cheers, |
Original Redmine Comment Yes, if you could take a look that would be great. For queues I didn't touch any code related for foreach which seems in retrospect suspicious as think should have been needed. BTW with the display removed the optimizer will likely remove the foreach entirely which is probably why that makes it happy. |
Original Redmine Comment Strangely, I don't observe that the error disappears when the display is commented out. It seems purely related to expecting to be an rvalue when it actually isn't for me. |
Original Redmine Comment So, the issue itself seems to be easy: https://github.com/wallento/verilator/tree/issue-1641 As you mention, Wilson, the foreach seems to not work as expected it seems. I am not sure about the syntax, but
is supposed to print
Do I understand that correct? I will look into it tomorrow then. Cheers |
Original Redmine Comment I presume that's correct ([0] then [1] which contains 2 then 1). Also good idea to add test of foreach on an empty queue. |
Original Redmine Comment Okay, I am at it. |
Original Redmine Comment Hi, quick update:
Cheers, |
Original Redmine Comment So, it seems that moving it from LinkParse to LinkDotResolve may make sense, with some minor tweaks. |
Original Redmine Comment
|
Original Redmine Comment Sorry, about 1. I meant standard arrays, not queues. I was checking them as drive by and an array with size 0 is accepted, but iterates incorrectly (identical to queue). I think it should be forbidden to have an array with size 0. Yes, I am checking the dynamic size and the problem is in the code generated by the V3Width, because it will count from 0 to -1. I have been playing around now and it seems that as you write I must move the foreach->while transformation into the WidthVisitor. But I am now facing that I need to update my AST manipulation skills as I run into "unlinked" errors :) btw: I don't receive redmine update mails anymore, is this intentional or an error on my side? |
Original Redmine Comment I agree a zero size "normal" array, or a negative queue bound should be checked and flagged as an error. (As separate or combined patch from rest of this bug, whatever.) I see redmine sending you mails and their being accepted by your mail server. |
Original Redmine Comment The original issue here was "Allow queue operations to be used as statement". The first commit in the branch above solves it. I moved the other two issues that we discovered to #1642 and #1643, considering this issue itself solved. |
Original Redmine Comment Peter, thanks for reporting, Stefan thanks for the great work. Pushed (Stefan commit one) to git towards eventual 4.026 release. |
Author Name: Peter Monsson
Original Redmine Issue: 1641 from https://www.veripool.org
Hi Wilson,
Thank you for adding queues and associative arrays to Verilator. This is amazing!
I played around with it a little. The following code snippet in make_tracing_c:
// queue.pop_back();
$display("ok");
end
Fails with this error:
In file included from Vtop__ALLcls.cpp:3:0:
Vtop.cpp: In static member function ‘static void Vtop::_initial__TOP__1(Vtop__Syms*)’:
Vtop.cpp:116:40: error: expected ‘;’ before ‘VL_WRITEF’
vlTOPp->top__DOT__queue.pop_front()VL_WRITEF("ok\n");
^~~~~~~~~
/home/pmonsson/verilator/include/verilated.mk:182: recipe for target 'Vtop__ALLcls.o' failed
make[1]: *** [Vtop__ALLcls.o] Error 1
make[1]: Leaving directory '/home/pmonsson/verilator/examples/make_tracing_c/obj_dir'
Makefile:59: recipe for target 'run' failed
make: *** [run] Error 2
This happens both with pop_front and pop_back after the foreach with the display. If the display inside the foreach is commented out, then I get no error.
The text was updated successfully, but these errors were encountered: