Skip to content

[Feature] Implement DMA support#293

Open
BenkangPeng wants to merge 10 commits into
tancheng:masterfrom
BenkangPeng:dma-cgra
Open

[Feature] Implement DMA support#293
BenkangPeng wants to merge 10 commits into
tancheng:masterfrom
BenkangPeng:dma-cgra

Conversation

@BenkangPeng
Copy link
Copy Markdown
Collaborator

Related issue: coredac/CGRA-SoC#2

This PR introduces CgraDmaRTL which integrates the CGRA with a DMA engine, enabling direct memory transfers between external DRAM(don't implement now) and the CGRA's dataSPM.

@BenkangPeng BenkangPeng requested review from HobbitQia and tancheng June 2, 2026 13:55
Comment thread mem/dma/DmaEngineRTL.py
Comment on lines +15 to +16
DMA_MVIN = 0
DMA_MVOUT = 1
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Comment thread mem/dma/DmaEngineRTL.py
external DRAM-like memory and the on-chip Scratchpad Memory (dataSPM).

It supports two main operations:
- DMA_MVIN: DRAM -> DMA Engine -> SPM
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Rename to DMA_INFEED and DMA_OUTFEED?

Comment thread mem/dma/DmaEngineRTL.py
DMA_MVOUT = 1


class DmaEngineRTL( Component ):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Would this also handle instructions/control signals delivery besides data?

Comment thread mem/dma/DmaEngineRTL.py
SpmDataType = mk_bits( spm_data_nbits )
MemDataType = mk_bits( mem_data_nbits )
# Byte mask for SPM write; 1 byte = 8 bits
SpmMaskType = mk_bits( spm_data_nbits // 8 )
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Define CHAR_BIT = 8 inside https://github.com/tancheng/VectorCGRA/blob/master/lib/util/common.py and use it here: // CHAR_BIT

Comment thread mem/dma/DmaEngineRTL.py

# Abstract external memory interface
# Request to read from DRAM
s.mem_rd_req_val = OutPort()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

change all mem to dram, to distinguish it from sram?

Comment thread mem/dma/DmaEngineRTL.py
s.spm_dma_rresp_data = InPort( SpmDataType )

# State machine definitions
StateType = mk_bits( 4 )
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Comment thread cgra/CgraDmaRTL.py
Comment on lines +116 to +118
s.mem_rd_req_val = OutPort() # dma_read_request_valid
s.mem_rd_req_rdy = InPort() # dma_read_request_ready
s.mem_rd_req_addr = OutPort(DmaDramAddrType)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why can't we use the RecvIfcRTL and SendIfcRTL interfaces to connect the DmaRTL?

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.

2 participants