Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cdc/rtl/br_cdc_bit_pulse.sv
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ module br_cdc_bit_pulse #(
input logic dst_rst,
output logic dst_pulse
);
// Integration Assertions

//------------------------------------------
// Integration checks
//------------------------------------------
// Relying on checks in br_cdc_bit_toggle

`BR_ASSERT_CR_INTG(src_pulse_high_then_low_a, src_pulse |=> !src_pulse, src_clk, src_rst)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add these in my PR because I think this is too stringent. If the source clock is much slower than the destination clock, it would be perfectly fine to have two back to back pulses.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree: the purpose of the module is to transfer pulses. If you're saying you don't have to pulse on the sender side then it seems ill-defined?

Also "two back to back pulses" means there must be a falling edge between, no?

`BR_COVER_CR_INTG(back_to_back_src_pulse_c, src_pulse ##2 src_pulse, src_clk, src_rst)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conversely, if the source clock is much faster than the destination clock, it may not be safe to have pulses two cycles apart on the source clock.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose if this is true then you should probably use a 1-bit CDC FIFO?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can guarantee that the pulses are sufficiently spaced on the source side, you don't need to use a FIFO. I think if you want to add this cover, you should have a parameter like MinPulseSeparation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right so I only see two possibilities. Unless I'm missing something.

  1. If you want to guarantee no data loss - use a CDC FIFO.
  2. If you can guarantee the source pulses are far enough apart that they can be synchronized to destination - use this.

If 2, then shouldn't we have the source side assert MinPulseSeparation unconditionally? If it fails, the user should switch to CDC FIFO for their use case?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think have an assert that the pulses are minimum number of cycles apart and have the minimum be configurable.


//------------------------------------------
// Implementation
//------------------------------------------
logic src_level;
logic dst_level;
logic dst_level_d;
Expand Down Expand Up @@ -98,7 +106,10 @@ module br_cdc_bit_pulse #(
assign dst_pulse = dst_pulse_internal;
end

// Implementation assertions
// TODO(zhemao): Add some here
//------------------------------------------
// Implementation checks
//------------------------------------------
`BR_ASSERT_CR_IMPL(dst_pulse_high_then_low_a, dst_pulse |=> !dst_pulse, dst_clk, dst_rst)
`BR_COVER_CR_IMPL(back_to_back_dst_pulse_c, dst_pulse ##2 dst_pulse, dst_clk, dst_rst)

endmodule
3 changes: 0 additions & 3 deletions enc/sim/br_enc_bin2onehot_tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ module br_enc_bin2onehot_tb;
// Finish simulation
#10;

// TODO(mgottscho): not enough information to know if test passed.
// If DUT asserts fire, we can't see that here.
// Need to determine pass/fail outside of this TB?
if (errors) begin
$display("Number of errors: %0d", errors);
$display("TEST FAILED");
Expand Down