DecoupledIO, EnqIO, DeqIO, and ready signal

1,109 views
Skip to first unread message

Raghu Prabhakar

unread,
Feb 23, 2017, 5:52:42 PM2/23/17
to chisel-users
Hi all,

I'm trying to understand DecoupledIO. Here's a simple design:

class Dummy() extends Module {
  val io = IO(new Bundle {
    val in = Input(DecoupledIO(UInt(10.W)))
  })
}

The Verilog interface generated for this module is (correctly) as below:

module Dummy(
  input   clock,
  input   reset,
  output  io_in_ready,
  input   io_in_valid,
  input  [9:0] io_in_bits
); 

However, when I try to assign something to the 'ready' from within the module, it results in a Chisel compiler error:

io.in.ready := Bool(true) // Within the 'Dummy' module, causes the error below:

[error] (run-main-e) chisel3.internal.ChiselException: Connection between sink (chisel3.core.Bool@10) and source (chisel3.core.Bool@15) failed @: Sink is unwriteable by current module.
chisel3.internal.ChiselException: Connection between sink (chisel3.core.Bool@10) and source (chisel3.core.Bool@15) failed @: Sink is unwriteable by current module.
        at chisel3.internal.throwException$.apply(Error.scala:13)
        at chisel3.core.Data.connect(Data.scala:145)
        at chisel3.core.Data.$colon$eq(Data.scala:204)
        at example.Dummy.<init>(Dummy.scala:15)
        ...

1. Why is this assignment wrong? How should one use DecoupledIO?
2. I noticed that EnqIO, DeqIO, and DecoupledIO all generate the same interface. Are they all functionally equivalent?

Thanks,
Raghu

Jim Lawson

unread,
Feb 23, 2017, 6:16:26 PM2/23/17
to chisel...@googlegroups.com
I suggest using the Decoupled factory method which wraps user-defined Data (typically a Bundle) with the DecoupledIO interface. Examples of such usage can be found in DecoupledAdder in the chisel-testers repo.


--
You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users+unsubscribe@googlegroups.com.
To post to this group, send email to chisel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/0691ca29-af35-4868-ae5f-1aa4a6cb524d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raghu Prabhakar

unread,
Feb 24, 2017, 1:25:53 AM2/24/17
to chisel-users
Cool, thanks. I changed the interface to be as below (following the example) and it works.
  val io = IO(new Bundle {                                                      
    val dec = Flipped(Decoupled(UInt(10.W)))
  })
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.

neville

unread,
Apr 15, 2020, 5:33:35 AM4/15/20
to chisel-users
I have a follow-up question regarding (2)
enqIO and decoupledIO seem to be different in my understanding. Can someone correct me if I am wrong?
enqIO when used for a queue of depth>1 uses ready signal to indicate whether the queue is still enqueuable. 
However, decoupledIO uses ready signal to indicate whether the valid data (which was sent by a producer) was accepted by the consumer or not.
Reply all
Reply to author
Forward
0 new messages