-
Notifications
You must be signed in to change notification settings - Fork 903
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
Yosys not removing DFF with constant input and replacing with a constant driver. #4266
Comments
Hello Claire @clairexen , |
I could be wrong, but I think this is because Testing locally I had success with the following script:
Where abc runs on the yosys internal cells, allowing the call to |
Thanks @KrystalDelusion ! |
Hi @KrystalDelusion ,
PS: |
Could you please help with another query I have, that is not directly related to the original topic of this issue ?
|
I'll go ahead and close this issue then.
If you mark something with the "keep" attribute then it will prevent Yosys from optimising it out. E.g.
results in the following block in the output verilog:
|
Thanks @KrystalDelusion ! |
Attributes don't apply to code sections, they apply to specific design elements (modules, wires and cells). In this case if it is set on a signal declaration, it ensures that a signal of this name remains in the design and is driven with the correct value. But it can optimize away anything in the input cone of the signal that is not necessary to produce the value, e.g. if you say |
Thanks @nakengelhardt ! I was experimenting it out in Yosys after I posted the query and was able to get what I wanted by adding (* keep *) to some of the required signal declarations. |
Version
Yosys 0.34+43 (git sha1 d21c464, gcc 9.4.0-1ubuntu1~20.04.2 -fPIC -Os)
On which OS did this happen?
Linux
Reproduction Steps
Expected Behavior
Actual Behavior
While I was doing basic checks of the synthesis output netlist, I found that there are three DFF instances that have a constant input of 1'h0.
![DFF_with_constant_inputs](https://private-user-images.githubusercontent.com/79094513/310845345-b6897f95-558f-46e1-b1b5-db30b53c46ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NjQ1ODYsIm5iZiI6MTczODg2NDI4NiwicGF0aCI6Ii83OTA5NDUxMy8zMTA4NDUzNDUtYjY4OTdmOTUtNTU4Zi00NmUxLWIxYjUtZGIzMGI1M2M0NmFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE3NTEyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTViNjc4YmVkYjcyZjc2YmFhNDBjOTdjYjFkNzYxN2M0Y2E5ODNmNThjNzQxMWU2NjA3ODYzZjE3ZWMzMGQyZDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.HKKFhrOtfXo1Yy0FxA3FxQyFmjh17Otzj4kyvVwg_aU)
In the ABC result, I can see that there are three const0 cells (which I believe must correspond to the above three DFF instances
![ABC_Results_const0](https://private-user-images.githubusercontent.com/79094513/310845305-d9cdf1a8-87aa-4e99-94ec-de2c0aaeed7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NjQ1ODYsIm5iZiI6MTczODg2NDI4NiwicGF0aCI6Ii83OTA5NDUxMy8zMTA4NDUzMDUtZDljZGYxYTgtODdhYS00ZTk5LTk0ZWMtZGUyYzBhYWVlZDdkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDE3NTEyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmZjk1ZDgwZDgzZTIxZDA3M2UzNjMzZTQ2YzE0MjBiYThjM2E2YzcxZWI4MDBiODQxYTI3NGNkMTM2NTE2NTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.kkrmpMNB4O-hicxmYpNWSQk7QNVAp24HGl0Ljb4MtW0)
I even tried adding another opt command (which should by default run opt_dff) after the abc command, but these 3 DFF instances with constant input are kept as is.
Please find attached the following:
For taking a quick look, attaching some of the files directly here:
The text was updated successfully, but these errors were encountered: