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

Fix reading and writing to mtimeh/mtimecmph on 64b Fabrics #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

heshamelmatary
Copy link

No description provided.

Example:
li s0, (CLINT_BASE + MTIMEH_OFFSET) // 0x_xxxx_bffc
lw t0, 4(s0)

t0 won't get the correct value

mkNear_Mem_IO.rl_process_rd_req properly puts the value in the low 4-bytes of
rdata, however, MMU_Cache.rl_io_near_mem_read_rsp uses
fn_extract_and_extend_bytes which extracts the upper 4-bytes of the returned
rdata (assuming a 64-bit aligned AXI rdata is returned).

The commit properly composes a read reponse as mkNear_Mem_IO.rl_process_rd_req
expects.
Example:
li  s0, (CLINT_BASE + MTIMECMPH_OFFSET) // 0x_xxxx_4004
sw t0, 4(s0)

MMU_Cache.fn_to_fabric_write_fields composes a 64-bit wdata assuming the waddr
is always gonna be 64-bit aligned, and thus puts the requested_wdata in the
upper 4-bytes of word64 with the corresponding 0xf0 strobe.

mkNear_Mem_IO.rl_process_wr_req however, handles writes to 0xxxx_bffc/0xxxx_4004,
expecting the wdata to contain the value in the LSB (lower 4 bytes).

The commit fixes mkNear_Mem_IO.rl_process_wr_req to handle "SW" writes on 64b fabrics
by extracting the upper 4-bytes set by MMU_Cache.fn_to_fabric_write_fields.
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

Successfully merging this pull request may close these issues.

None yet

1 participant