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

[dv,top_earlgrey] baudrate not configurable via configure_uart_agent #21188

Open
dahooz opened this issue Feb 5, 2024 · 0 comments
Open

[dv,top_earlgrey] baudrate not configurable via configure_uart_agent #21188

dahooz opened this issue Feb 5, 2024 · 0 comments

Comments

@dahooz
Copy link

dahooz commented Feb 5, 2024

Description

In chip_base_vseq.sv there is a function to configure the uart agents:

virtual function void configure_uart_agent(int uart_idx,
bit enable,
bit enable_tx_monitor = 1'b1,
bit enable_rx_monitor = 1'b0,
bit en_parity = 1'b0,
bit odd_parity = 1'b0,
baud_rate_e baud_rate = cfg.uart_baud_rate);
if (enable) begin
`uvm_info(`gfn, $sformatf("Configuring and connecting UART%0d", uart_idx), UVM_LOW)
cfg.m_uart_agent_cfgs[uart_idx].set_parity(en_parity, odd_parity);
cfg.m_uart_agent_cfgs[uart_idx].set_baud_rate(cfg.uart_baud_rate);
cfg.m_uart_agent_cfgs[uart_idx].en_tx_monitor = enable_tx_monitor;
cfg.m_uart_agent_cfgs[uart_idx].en_rx_monitor = enable_rx_monitor;
cfg.chip_vif.enable_uart(uart_idx, 1);
end else begin
`uvm_info(`gfn, $sformatf("Disconnecting UART%0d", uart_idx), UVM_LOW)
cfg.m_uart_agent_cfgs[uart_idx].en_tx_monitor = 0;
cfg.m_uart_agent_cfgs[uart_idx].en_rx_monitor = 0;
cfg.chip_vif.enable_uart(uart_idx, 0);
end
endfunction

In Line 243, the function parameter is ignored, and the baudrate from chip_env_cfg is used. Thus, setting a different baudrate via function parameter has no effect.

Solution:

-      cfg.m_uart_agent_cfgs[uart_idx].set_baud_rate(cfg.uart_baud_rate);
+      cfg.m_uart_agent_cfgs[uart_idx].set_baud_rate(baud_rate);

This probably remained unnoticed, because baudrate testing in chip_sw_uart_rand_baudrate_vseq.sv uses chip_env_cfgs uart_baud_rate instead of the configure_uart_agent function:

https://github.com/lowRISC/opentitan/blob/master/hw/top_earlgrey/dv/env/seq_lib/chip_sw_uart_rand_baudrate_vseq.sv#L42-L45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant