opentitan icon indicating copy to clipboard operation
opentitan copied to clipboard

[gpio] Noise filter filters out gpio pin value after 15.5 cycles

Open gaurangchitroda opened this issue 7 years ago • 4 comments

Hi Eunchan,

I have created a directed test wherein gpio pin toggles to a new value on negedge of clock and then remains with same value for 15.5 cycles (That is, negedge to subsequent posedge, plus 15 full clock cycles). After these 15 cycles are finished, I test make the gpio pin toggle again. This means pin has not been stable for full 16 cycles. However, I see that RTL still updates data_in register with after mentioned 15.5 cycles were finished, even though filter is designed for 16 cycles. Even INTR_STATE is getting updated due to latching update. As per my understanding GPIO data should be allowed to be driven even synchronously. This looks like a bug as specification does not mention about driving restrictions. Please let me know your thoughts on the same.

Following is the screenshot of waveform, wherein period between markers M2 and M3 indicate the 15.5 cycle period. image

The paths for waveform and session file are following: /edascratch/gaurangg-opentitan/issue_509/waves.fsdb /edascratch/gaurangg-opentitan/issue_509/signal_issue_509.rc

Following are timestamps of interest: Marker M2, 1985711ps: gpio input on pin-0 toggles from 0 to 1 Marker M3, 2308623ps: gpio input on pin-0 toggles again from 1 to 0, after 15.5 clock cycles Values of DATA_IN and INTR_STATE registers get updated at the same time Marker M4, 2412788ps: Read data for DATA_IN reg read reflects updated value based on pin-0 Marker M5, 2683617ps: Read data for INTR_STATE reg read reflects updated value based on pin-0

Best Regards, Gaurang

gaurangchitroda avatar Oct 17 '19 18:10 gaurangchitroda

Hi Gaurang, That is 16 cycle. The design checks the posedge to filter out, and you can see that it has 16 edges.

eunchan avatar Oct 17 '19 18:10 eunchan

Hi Eunchan,

I would like to think that 16 posedges are not same as 16 clock cycles. The specification mentions following:

filter enable for GPIO input bits. If CTRL_EN_INPUT_FILTER[i] is true, a value of input bit [i] must be stable for 16 cycles before transitioning.

I am saying this because GPIO does not emphasize on any requirement of driving data synchronous to posedge of clock.

Best Regards, Gaurang

gaurangchitroda avatar Oct 17 '19 19:10 gaurangchitroda

IMO, cycle usually imply a clock. Check needs to count number of active clock edge.

weicaiyang avatar Oct 18 '19 21:10 weicaiyang

Test prediction has been updated (#680) to match dut behavior. Closing this issue.

gaurangchitroda avatar Oct 29 '19 23:10 gaurangchitroda