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

[pinmux/padctrl] First round of (mostly CSR facing) pinmux updates #5128

Merged
merged 5 commits into from
Feb 12, 2021

Conversation

msfschaffner
Copy link
Contributor

Note that this is a WIP PR and there are still several things I need to change.

Putting this up to enable early feedback only.

@msfschaffner
Copy link
Contributor Author

Please do not review just yet - I will ping you once this is (sort of) stable.

@msfschaffner msfschaffner force-pushed the pinmux-updates branch 2 times, most recently from 8a99adf to a1459fc Compare February 6, 2021 02:44
@msfschaffner msfschaffner force-pushed the pinmux-updates branch 4 times, most recently from 6e0e841 to 95e393e Compare February 6, 2021 03:41
logic [NDioPads-1:0] dio_out_retreg_q, dio_oe_retreg_q;

// Sleep entry trigger
assign sleep_trig = sleep_en_i & ~sleep_en_q;
Copy link

Choose a reason for hiding this comment

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

can you file an issue on me to figure out exactly which pwrmgr signal to connect? There isn't anything existing that fits..because the first thing pwrmgr does is shut off the clocks, which would mess up this logic unless you want to put it on the clk_aon_i domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jep, see here: #5198

hw/ip/pinmux/rtl/pinmux.sv Outdated Show resolved Hide resolved
@msfschaffner
Copy link
Contributor Author

I'll double check - however apart from the compact/noncompact multireg change, the pinmux configuration should not have to be different after this change (there are no changes to the #MIOs and pinout in this PR). I've adapted the pinmux initialization function to reflect the compact -> noncompact change.

@msfschaffner
Copy link
Contributor Author

Good call @tjaychen!
Looks like I optimized too much away when I removed the IO_POK signals:

- assign mio_data_mux = AlignedMuxSize'({(&io_pok_i) ? mio_in_i : '0, 1'b1, 1'b0});
+ assign mio_data_mux = AlignedMuxSize'(mio_in_i);

Find the error ;)...

@tjaychen
Copy link

tjaychen commented Feb 12, 2021 via email

@tjaychen
Copy link

@msfschaffner if you haven't done so already, could you update the spreadsheet containing the memory map to remove padctrl?

@msfschaffner
Copy link
Contributor Author

Sure will do!

If this looks good to you, I will squash most of this into one commit to make this giant thing atomic.

This also aligns the pinmux initialization code accordingly.

I.e., due to the multibit REGWENs, the pinmux insel/outsel CSRs have
to be non-compact, and therefore the initialization function needs
to be adapted for this to work.

Signed-off-by: Michael Schaffner <[email protected]>
In particular, this adds a per pad sleep status bit that stays asserted
when coming back from deep sleep until SW clears it.
The sleep behavior of the corresponding pad will only be disabled if SW
clears that status bit.

Signed-off-by: Michael Schaffner <[email protected]>
Note that hw/ip/padctrl still contains some legacy documentation
material and design sources that need to be moved or merged with the
pinmux docs. This will be done in a separate PR.

Signed-off-by: Michael Schaffner <[email protected]>
Signed-off-by: Michael Schaffner <[email protected]>
@msfschaffner
Copy link
Contributor Author

The latest force push squashes some of the commits together to make them atomic.

@tjaychen
Copy link

tjaychen commented Feb 12, 2021 via email

@msfschaffner
Copy link
Contributor Author

No worries. Can you push the green button ;)?

HighTimed: begin
aon_cnt_en = aon_filter_out_d;
aon_wkup_pulse = aon_cnt_eq_th;
end
default: ; // also covers "Disabled"
LowTimed: begin

Choose a reason for hiding this comment

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

i forgot to ask this earlier. but if someone didn't want any debounce, and were okay with this anytime this signal is high or low, would they just a really low threshold count? (0 or 1?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pulse counter is separate from the debouncing logic.
In fact, we've got a prim_filter in each wakeup detector, which can be enabled or desabled via a CSR (see separate comment).

Choose a reason for hiding this comment

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

o sorry, i should correct myself then. I guess I meant if someone wanted any length of a pulse to trigger.
Would they basically set this to 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's right, you could do that or just use the edge detector feature instead.

of always-on clock cycles as configured in !!WKUP_DETECTOR_CNT_TH.
'''
},

]
}
{ bits: "3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: @tjaychen this is the register I have been talking about in the other comment

@@ -51,7 +51,7 @@ module pinmux_wkup import pinmux_pkg::*; import pinmux_reg_pkg::*; #(
always_ff @(posedge clk_aon_i or negedge rst_aon_ni) begin : p_sync
if (!rst_aon_ni) begin
aon_wkup_en_q <= 1'b0;
aon_wkup_mode_q <= Disabled;
aon_wkup_mode_q <= Posedge;
aon_filter_en_q <= 1'b0;
aon_wkup_cnt_th_q <= '0;
end else begin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI @tjaychen: see on line 75ff below

@msfschaffner
Copy link
Contributor Author

Thanks for the review, pulling this in now!

@msfschaffner msfschaffner merged commit 390251b into lowRISC:master Feb 12, 2021
cindychip added a commit to cindychip/opentitan that referenced this pull request Mar 4, 2021
This PR implements the DV support for PR lowRISC#5128, which allows an enable
register to be a multi-reg. This enable register will have many fields,
each field locks a certain set of registers.

This PR support it by moving the `locked_reg_q` to dv_base_reg_field,
and copied enable register related methods to dv_base_reg_field. If the
enable register has only one field, normal methods still work (which
means we do not need to change current testbench). If the enable
register has more than one field, CSR automation test will work, but if
user want to access the `locked_reg_q`, they have to call from
dv_base_reg_field rather than dv_base_reg.

This PR also updated the UVM RAL register generate script.

Signed-off-by: Cindy Chen <[email protected]>
sriyerg pushed a commit that referenced this pull request Mar 4, 2021
This PR implements the DV support for PR #5128, which allows an enable
register to be a multi-reg. This enable register will have many fields,
each field locks a certain set of registers.

This PR support it by moving the `locked_reg_q` to dv_base_reg_field,
and copied enable register related methods to dv_base_reg_field. If the
enable register has only one field, normal methods still work (which
means we do not need to change current testbench). If the enable
register has more than one field, CSR automation test will work, but if
user want to access the `locked_reg_q`, they have to call from
dv_base_reg_field rather than dv_base_reg.

This PR also updated the UVM RAL register generate script.

Signed-off-by: Cindy Chen <[email protected]>
@msfschaffner msfschaffner deleted the pinmux-updates branch February 18, 2022 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants