Skip to content

Add register read-port constraint validation for direct routing bypass#275

Closed
guosran wants to merge 2 commits intotancheng:masterfrom
guosran:feat/register-routing-constraint
Closed

Add register read-port constraint validation for direct routing bypass#275
guosran wants to merge 2 commits intotancheng:masterfrom
guosran:feat/register-routing-constraint

Conversation

@guosran
Copy link
Copy Markdown
Collaborator

@guosran guosran commented Mar 17, 2026

Summary

This PR addresses coredac/neura#283. It validates hardware constraint during mapping: if computation and routing bypass both read from the same register cluster in the same time step, they must read the identical register index.

Changes

  • New function _is_reg_to_outport_routing(): identifies REG→PORT routing operations
  • Modified _is_take_up_fu_operation(): returns False for MOV with PORT destinations only
  • Two-pass buildCtrlPkt():
    • Pass 1: FU-bound operations
    • Pass 2: Routing bypass with constraint validation
    • Support routing-only instructions: No FU involvement allowed
  • Thread num_tile_inports: Enables flexible tile configurations

… bypass

Implement hardware constraint validation in the mapping/compilation phase to
ensure correct control word generation for the new register → routing_crossbar
direct data path (VectorCGRA feature).

Key changes:
- Identify routing bypass operations (REG → PORT MOV/DATA_MOV)
- Enforce single read-port constraint: if computation and routing bypass both
  read from the same register cluster in same time step, they MUST read the
  identical register index
- Two-pass processing: FU-bound operations first, then routing bypass
  operations with constraint validation
- Support instructions with only routing operations (no FU involvement)
- Thread num_tile_inports parameter through mapper for flexible tile configs
- Restore and improve comments with third-person-singular verb form

Validation tested with:
- Direct constraint violation/acceptance tests
- Routing bypass with standalone and mixed operations
- Full module import and pytest collection

Made-with: Cursor
@guosran guosran requested review from Jackcuii and tancheng March 17, 2026 05:43
return 'IMM'

def _is_take_up_fu_operation(operation):
if operation['opcode'] == 'MOV' or operation['opcode'] == 'DATA_MOV':
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.

I actually doubt about this _is_take_up_fu_operation() func. I thought all operations except mov should take up fu. mov shouldn't be "operation". So in summary, I thought this func should be:

def _is_take_up_fu_operation(operation):
    if operation['opcode'] == 'MOV' or operation['opcode'] == 'DATA_MOV':
        return False
    return True

CCing @Jackcuii.

@tancheng
Copy link
Copy Markdown
Owner

Hi @guosran, coredac/neura#283 is for fixing the mapper in dataflow compiler, instead of this VectorCGRA repo. Do you think we also need to refine this script?

@guosran
Copy link
Copy Markdown
Collaborator Author

guosran commented Mar 17, 2026

Hi @guosran, coredac/dataflow#283 is for fixing the mapper in dataflow compiler, instead of this VectorCGRA repo. Do you think we also need to refine this script?

Sorry my bad...

@guosran guosran closed this Mar 17, 2026
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