Skip to content

hw: Add new common cells to down/up size data stream - #363

Merged
phsauter merged 7 commits into
masterfrom
new/stream-sizer
Sep 18, 2026
Merged

phsauter merged 7 commits into
masterfrom
new/stream-sizer

Conversation

@Lore0599

@Lore0599 Lore0599 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Add cc_stream_downsizer / cc_stream_upsizer

This PR introduces two generic ready/valid stream width converters, parametrized.

New Cells

  • cc_stream_downsizer drains one wide beat into WideWidth/NarrowWidth narrow beats, LSB first. It doesn't register the wide word: as long as inp_ready_o is low, the master must hold it stable anyway (standard handshake rule), so each slice is just indexed straight off inp_data_i.

  • cc_stream_upsizer does the reverse. Here each narrow beat is genuinely new data, so the first Ratio-1 slices do need to be captured into a register bank. The last slice is the exception: it's streamed out
    combinationally together with the stored ones; in the same cycle it's accepted, instead of being registered and presented a cycle later. That keeps its acceptance directly tied to oup_ready_i, and means the sequence "accept last slice of one word" / "start accepting the first slice of the next" costs zero extra cycles.

HW cost:

Downsizer is register-free besides the counter; upsizer holds (Ratio-1) * NarrowWidth bits of state. Neither adds combinational depth beyond cc_counter's own.

Testbench

Add two testbenches generated by AI 🤖

@Lore0599
Lore0599 requested review from colluca and phsauter and removed request for colluca September 18, 2026 08:02
Comment thread src/cc_stream_downsizer.sv Outdated
Comment thread src/cc_stream_downsizer.sv
Comment thread src/cc_stream_upsizer.sv Outdated
Comment thread test/cc_stream_downsizer_tb.sv Outdated

@colluca colluca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Few minor comments left

Comment thread src/cc_stream_downsizer.sv Outdated
Comment thread src/cc_stream_downsizer.sv Outdated
Comment thread src/cc_stream_upsizer.sv Outdated

@phsauter phsauter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Assertions are working and testbenches as well, everything looks good.

@phsauter
phsauter added this pull request to the merge queue Sep 18, 2026
Merged via the queue into master with commit e73baae Sep 18, 2026
4 checks passed
@phsauter
phsauter deleted the new/stream-sizer branch September 18, 2026 17:11
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.

3 participants