Giter Club home page Giter Club logo

Comments (11)

likewise avatar likewise commented on June 9, 2024

image

This is a R channel of axilite4 generated by regif.....

Looks good. The read data is value 0.

Or is there a reason to think that value is not expected? We cannot tell from the screenshot.

from spinalhdl.

zyn810039594 avatar zyn810039594 commented on June 9, 2024

image
This is a R channel of axilite4 generated by regif.....

Looks good. The read data is value 0.

Or is there a reason to think that value is not expected? We cannot tell from the screenshot.

image
The Data after DoRead is 0000023D.

from spinalhdl.

zyn810039594 avatar zyn810039594 commented on June 9, 2024

For signal with same names,
image

from spinalhdl.

andreasWallner avatar andreasWallner commented on June 9, 2024

Since the data send to be changing, what type of bitfield is this? Could you provide a small example that reproduces this behaviour so that we can debug it?

from spinalhdl.

zyn810039594 avatar zyn810039594 commented on June 9, 2024

Ok, I've tested as this module:

class regAxiLite extends Component {
    val io = new Bundle {
        val axiLite = slave(AxiLite4(32, 32))
    }
    val busIf   = AxiLite4BusInterface(io.axiLite, (0x000, 48 Bytes), "Test_axilite")
    val test0   = busIf.newReg("Test_reg")
    val test0_0 = test0.field(Bool(), RW, 1)
    val test0_1 = test0.field(Bool(), RW, 0)
    val test0_2 = test0.field(Bool(), RW, 1)
    val test0_3 = test0.field(Bits(3 bit), RW, 7)
    val test0_4 = test0.fieldAt(pos = 8, UInt(8 bit), RW, 2)
    busIf.accept(RalfGenerator("header"))
}

This is my test code:

object regAxiLiteSim extends App {
    Config.sim.compile(new regAxiLite).doSim { dut =>
        // Fork a process to generate the reset and the clock on the dut
        dut.clockDomain.forkStimulus(period = 10)
        SimTimeout(100000)
        val port = dut.io.axiLite

        port.aw.valid #= false
        port.w.valid #= false
        port.ar.valid #= false
        port.r.ready #= false
        port.b.ready #= false

        sleep(1000)
        dut.clockDomain.waitActiveEdge()
        port.ar.valid #= true
        port.ar.addr #= 0
        port.ar.prot #= 0
        dut.clockDomain.waitActiveEdge()
        while (!port.ar.ready.toBoolean) {
            dut.clockDomain.waitActiveEdge()
            println("Wait for ar ready active...")
        }
        port.ar.valid #= false
        dut.clockDomain.waitActiveEdge()
        while (!port.r.valid.toBoolean) {
            dut.clockDomain.waitActiveEdge()
            println("Wait for r valid active...")
        }
        //Wait for a extra clk, it's in line with the rules, right?
        println("Wait for a extra clk...")
        dut.clockDomain.waitActiveEdge()
        port.r.ready #= true
        println("Data is " + port.r.data.toBigInt.toString())
        dut.clockDomain.waitActiveEdge()
        port.r.ready #= false
        sleep(1000)

    }
}

(Sim with Verilator)

The wave is:
image

from spinalhdl.

zyn810039594 avatar zyn810039594 commented on June 9, 2024

So is there anything that I make mistake? Or anyway to solve it?

from spinalhdl.

cheerryio avatar cheerryio commented on June 9, 2024

My way to solve the problem is to go back to spinalHDL version 1.8.0b or earlier. And this works for me. Or you may wait for the issue to be fixed in later spinalHDL versions or you can develop on dev version.

from spinalhdl.

jijingg avatar jijingg commented on June 9, 2024

My way to solve the problem is to go back to spinalHDL version 1.8.0b or earlier. And this works for me. Or you may wait for the issue to be fixed in later spinalHDL versions or you can develop on dev version.

This problem was not introduced by 1.8.0. In fact, there is a bug. It’s just that the preservation circuit of readData did not expose this problem
old way

  private def readGenerator() = {
    when(askRead){
        readData  :=  .....    //readData hold
    }.otherwise{
      readError := False
    }
  }
}

after 1.8.0

  private def readGenerator() = {
    when(askRead){
        readData  :=  ..... 
    }.otherwise{
      readData  := readDefaultValue  //rdata cannot be retained, otherwise there will be security risks , SO KEEP 0 or defualtValue
      readError := False
    }
  }
}

so the fundamental solution is to modify lib/bus/regif/BusIfAdapter/AxiLite4BusInterfa

https://github.com/SpinalHDL/SpinalHDL/blame/dev/lib/src/main/scala/spinal/lib/bus/regif/BusIfAdapter/AxiLite4BusInterface.scala#L52

from spinalhdl.

likewise avatar likewise commented on June 9, 2024

My way to solve the problem is to go back to spinalHDL version 1.8.0b or earlier. And this works for me. Or you may wait for the issue to be fixed in later spinalHDL versions or you can develop on dev version.

This problem was not introduced by 1.8.0. In fact, there is a bug. It’s just that the preservation circuit of readData did not expose this problem old way

I'm not convinced this is the correct fix.

Do you have a minimal example exposing the bug?

from spinalhdl.

likewise avatar likewise commented on June 9, 2024

I see, the new code resets readData in the wrong state of the transaction.

See my comment on 230ab60.
My suggestion is to revert that commit.

from spinalhdl.

jijingg avatar jijingg commented on June 9, 2024

fix by expand askread cycle for workround .

  val askRead   = axiAr.valid || (axiR.valid && !axiR.ready)

image

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.