-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Lakeroad egglog backend #4
base: master
Are you sure you want to change the base?
Conversation
Apply the local substitutions stemming from process context when parsing out format arguments to `$display` or other statements.
- Add support for assignments within expressions, e.g., `x[y++] = z;` or `x = (y *= 2) - 1;`. The logic is handled entirely within the parser by injecting statements into the current procedural block. - Add support for pre-increment/decrement statements, which are behaviorally equivalent to post-increment/decrement statements. - Fix non-standard attribute position used for post-increment/decrement statements.
* Fixes a non-deterministic polarity error for $eqx/$nex cells * Fixes a deterministic polarity error for $_NOR_ and $_ORNOT_ cells * Generates hdlnames when xprop is run after flatten
…t, updated test script
How do I add a test to your PR? I found something that doesn't work:
This is the yosys file:
I get this error:
|
There are two approaches. In this case, you need a very basic test that just checks to make sure the Lakeroad backend doesn't crash when it runs on a given module. In that case, you should write a test that looks like Yosys's tests. Take a look at backends/lakeroad/example.ys. This test is a Yosys script that reads in a module and runs the backend. If no error is thrown, the test passes. So you could copy this file and change the module. The second type of test is something that doesn't currently exist in Yosys; this PR adds it. It realistically won't get merged into Yosys itself. But nevertheless, it's useful for doing fine-grained testing -- for example, if you want to make sure that the Lakeroad backend produces SPECIFIC output. For this I use |
How do I add the basic test then? It seems you only have Edit, just added a PR: #8 - can you check? Thanks. |
Look in this PR you're commenting on -- I gave the file path to example.ys
added by this PR -- you can copy that file and open a new PR that will
merge into this open PR (like what you did on the lakeroad repo a few weeks
ago).
More clearly: you should be adding the file into Yosys, not Lakeroad. And
you should add it specifically to this PR.
…On Wed, Dec 6, 2023, 11:54 AM Thanawat Techaumnuaiwit < ***@***.***> wrote:
How do I add the basic test then? It seems you only have lit tests in the
repo for lakeroad.
—
Reply to this email directly, view it on GitHub
<#4 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJFZAK2PYVNARDFV24MSK3YIDEQLAVCNFSM6AAAAAA4G52N3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGU4TIMBWGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I added a test here:
#8
…On Wed, Dec 6, 2023 at 2:14 PM Gus Smith ***@***.***> wrote:
Look in this PR you're commenting on -- I gave the file path to example.ys
added by this PR -- you can copy that file and open a new PR that will
merge into this open PR (like what you did on the lakeroad repo a few
weeks
ago).
More clearly: you should be adding the file into Yosys, not Lakeroad. And
you should add it specifically to this PR.
On Wed, Dec 6, 2023, 11:54 AM Thanawat Techaumnuaiwit <
***@***.***> wrote:
> How do I add the basic test then? It seems you only have lit tests in
the
> repo for lakeroad.
>
> —
> Reply to this email directly, view it on GitHub
> <#4 (comment)>, or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAJFZAK2PYVNARDFV24MSK3YIDEQLAVCNFSM6AAAAAA4G52N3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGU4TIMBWGU>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#4 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEAWXROII7TIP6RC4VCBQ6LYIDU4XAVCNFSM6AAAAAA4G52N3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTG43TINRVHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Great, thank you for this!
… Message ID: ***@***.***>
|
…ackend-tests Add a new test for the not cell.
…out. (#9) * Add code to write_lakeroad to file instead of stdout * Fix a bug for writing to stdout as well * Add suggested code
How should we make the egglog backend work for clocked designs? For example, this code:
implies a clocked design (using a global clock) and this needs the flip-flop cells to be implemented. Maybe I can implement it using |
Two things:
1. I'm not understanding what you mean when you say that that design
"implies a clocked design". The module is purely combinational -- there's
no register/flip flop (explicitly OR implicitly) in the design!
2. Clocked designs should already work out of the box! See the following
example of a permuter with a register on its output:
https://github.com/uwsampl/yosys/pull/4/files#diff-df8bc67a92c0805db2e06e9acdb0f35ae305dc5b7ac039d4647a343c4491a809
It used to be that Regs explicitly took a clock input; now they assume a
global clock. I may switch that back later though; I don't really
understand the benefits of an implicit global clock (other than terseness,
which I don't believe is something intermediate representations should care
about).
By the way -- we're finishing up ASPLOS camera ready today. After that I
will become much more free. I'm gonna send you/Jon/Zach an email about
potentially setting up recurring meetings.
…On Sun, Jan 7, 2024 at 9:24 PM Thanawat Techaumnuaiwit < ***@***.***> wrote:
How should we make the egglog backend work for clocked designs? For
example, this code:
module ALU_32bit (
input logic [4:0] operandA,
input logic [4:0] operandB,
input logic [3:0] control, // Control signal to specify the operation
output logic [4:0] result
);
always begin
case (control)
// 4'b0000: result = operandA + operandB; // Addition
2'b00: result = operandA + operandB; // Bitwise XOR
2'b01: result = operandA - operandB; // Subtraction
2'b10: result = operandA | operandB; // Bitwise OR
2'b11: result = operandA & operandB; // Bitwise AND
endcase
end
endmodule
implies a clocked design (using a global clock) and this needs the
flip-flop cells to be implemented. Maybe I can implement it using assign
(which .. maybe doesn't use a mux?? I have no clue on the semantics of
verilog).. but for more complex tests, I'll need the flipflops anyways...
Maybe there's a way to expand the flip-flops into gates with yosys? If
there is, please let me know. Thanks.
—
Reply to this email directly, view it on GitHub
<#4 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJFZAN5Y6V2JTCH6DE35FTYNN7HTAVCNFSM6AAAAAA4G52N3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGQYDEMBXGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Oh, when I compile it, it adds an |
Can you post the script you're using to compile it? Specifically, what Yosys passes are you running before you run the Lakeroad backend? |
Oh, I can do that when I get the chance! On mobile right now. |
I never figured out how to get the case statement working but I'll add a not-working test case in a branch later. I managed to get it working by using a ternary (the |
Try It's likely because of |
That is:
|
Oh yeah - the verilog experts in my lab helped resolve the issue. Thanks! |
No description provided.