Giter Club home page Giter Club logo

Comments (2)

louiecaulfield avatar louiecaulfield commented on June 2, 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)

from spinalhdl.

Dolu1990 avatar Dolu1990 commented on June 2, 2024

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

(PR welcome) ^^

from spinalhdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.