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

StreamFragmentWidthAdapter.make missing earlylast argument #1303

Open
louiecaulfield opened this issue Feb 6, 2024 · 2 comments
Open

StreamFragmentWidthAdapter.make missing earlylast argument #1303

louiecaulfield opened this issue Feb 6, 2024 · 2 comments

Comments

@louiecaulfield
Copy link
Contributor

The earlylast argument is not available in the StreamFragmentWidthAdapter's make methods

def make[T <: Data, T2 <: Data](input : Stream[Fragment[T]], outputPayloadType : HardType[T2], order : SlicesOrder) : Stream[Fragment[T2]] = {

@louiecaulfield
Copy link
Contributor Author

louiecaulfield commented Feb 7, 2024

Sorry to open this issue again (should I start a new one?), but further implementing the width adapter, I noticed the dataMask is not available when using the make convenience methods as the Area, containing the datamask, is not returned.

I worked around it by defining my own make functions as below, but I'm not so satisfied by the style.

class StreamFragmentWA
object StreamFragmentWA {
  def apply[T <: Data,T2 <: Data](input : Stream[Fragment[T]],output : Stream[Fragment[T2]], endianness : Endianness, earlyLast : Boolean = false): Bits = {
    StreamFragmentWA(input, output, endianness, false, earlyLast)
  }

  def apply[T <: Data,T2 <: Data](input : Stream[Fragment[T]],output : Stream[Fragment[T2]], endianness : Endianness, padding : Boolean, earlyLast : Boolean): Bits = {
    StreamFragmentWidthAdapter(input, output, endianness, padding, earlyLast).dataMask
  }

  def make[T <: Data, T2 <: Data](input : Stream[Fragment[T]], outputPayloadType : HardType[T2], endianness : Endianness, earlyLast : Boolean) : (Stream[Fragment[T2]], Bits) = {
    val ret = Stream(Fragment(outputPayloadType()))
    val mask = StreamFragmentWA(input,ret,endianness,false,earlyLast)
    (ret, mask)
  }
}

The in my module I write

val (axi_stream, axi_mask) = StreamFragmentWA.make(fifo.io.pop,
                                                    Bits(io.axi.config.dataWidth bits),
                                                    LITTLE,
                                                    earlyLast = true)

@Dolu1990 Dolu1990 reopened this Feb 12, 2024
@Dolu1990
Copy link
Member

Hmm what's about adding it to StreamFragment, but with an alternative name ?
makeWithMask ?

(PR welcome) ^^

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

2 participants