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

Ambiguous reset condition - nonce_offset_i #444

Closed
norman-stewart opened this issue Feb 29, 2024 · 7 comments
Closed

Ambiguous reset condition - nonce_offset_i #444

norman-stewart opened this issue Feb 29, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@norman-stewart
Copy link
Contributor

norman-stewart commented Feb 29, 2024

"./pcrvault/rtl/pv_gen_hash.sv"

Register nonce_offset_i is in "else" condition but not in reset condition of synchronous always block.
This asymmetry can lead to complications with LINT, netlist synthesis, and formal verification closure.

Current:
always_ff @(posedge clk or negedge rst_b) begin : api_regs
if (~rst_b) begin
gen_hash_fsm_ps <= GEN_HASH_IDLE;
block_offset_i <= '0;
read_entry <= '0;
read_offset <= '0;
end
else begin
gen_hash_fsm_ps <= gen_hash_fsm_ns;
block_offset_i <= block_offset_nxt;
nonce_offset_i <= nonce_offset_nxt;
read_entry <= read_entry_nxt;
read_offset <= read_offset_nxt;
end
end

Recommend:
always_ff @(posedge clk or negedge rst_b) begin : api_regs
if (~rst_b) begin
gen_hash_fsm_ps <= GEN_HASH_IDLE;
block_offset_i <= '0;
read_entry <= '0;
read_offset <= '0;
end
else begin
gen_hash_fsm_ps <= gen_hash_fsm_ns;
block_offset_i <= block_offset_nxt;
//nonce_offset_i <= nonce_offset_nxt;
read_entry <= read_entry_nxt;
read_offset <= read_offset_nxt;
end
end
always_ff @(posedge clk) begin : api_regs_noreset
nonce_offset_i <= nonce_offset_nxt;
end

or Recommend:
always_ff @(posedge clk or negedge rst_b) begin : api_regs
if (~rst_b) begin
gen_hash_fsm_ps <= GEN_HASH_IDLE;
block_offset_i <= '0;
nonce_offset_i <= '0;
read_entry <= '0;
read_offset <= '0;
end
else begin
gen_hash_fsm_ps <= gen_hash_fsm_ns;
block_offset_i <= block_offset_nxt;
nonce_offset_i <= nonce_offset_nxt;
read_entry <= read_entry_nxt;
read_offset <= read_offset_nxt;
end
end

@norman-stewart
Copy link
Contributor Author

Duplicates: #339

@Nitsirks
Copy link
Contributor

Can we include this in the lint PR?

@norman-stewart
Copy link
Contributor Author

Formality will not match #2.
Formality is unhappy so far with #1, but I don't yet see why. There's some modelling funny business on the implied yet missing reset condition. I think it results in a "dont_care" X in the "if" from a formal perspective.

We can include fix #2 in the PR, though it will break our RTL=RTL formal verification that is otherwise passing for all other proposed fixes.

@Nitsirks
Copy link
Contributor

Nitsirks commented Feb 29, 2024

We can sequence it as separate PRs, but I think this fix is a quality of life fix for integrators that should be pulled into 1.1. I'll let other weigh in on it if they have any objections.

I think fix 2 is my preference. Properly reset the signal.

@norman-stewart
Copy link
Contributor Author

Sure... let me send out summary and let's do PR with formality passing. There's some low hanging fruit in the remainder that we can swarm on quickly as an incremental.

@bharatpillilli
Copy link
Collaborator

@Nitsirks and @nstewart-amd - Could we please close this and other lint issues once the 1.1 Lint PR is completed?

@calebofearth
Copy link
Collaborator

(Same as #339) - This is addressed by commit 020cdc6 from #483

@calebofearth calebofearth added the bug Something isn't working label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants