SpinalHDL / SpinalHDL

Scala based HDL
Other
1.63k stars 317 forks source link

Ahb: add a "valid" function #733

Open numero-744 opened 2 years ago

numero-744 commented 2 years ago

There is the expression HSEL && HREADY && HTRANS(1) in AhbLite3.scala:143. This expression is also used

It is also in the expression of pendingWrite.valid in AhbLite3OnChipRam.scala:59 because

pendingWrite.valid := False
when(io.ahb.HREADY){
    pendingWrite.valid := io.ahb.HSEL && io.ahb.HTRANS(1) && io.ahb.HWRITE
}

is the same as (after having defined io.ahb.valid as the expression HSEL && HREADY && HTRANS(1))

pendingWrite.valid := io.ahb.valid && io.ahb.HWRITE

which looks trivial written this way.

I think this expression is useful for user implementations, so I suggest to add to the AhbLite3 bundle.

def valid = HSEL && HREADY && HTRANS(1)

I am discovering Ahb so tell me if the name valid is inappropriate here. I was also thinking to transactionValid or validTransaction.

Dolu1990 commented 2 years ago

hmm To follow the Stream way, i would say it should be :

def fire = HSEL && HREADY && HTRANS(1)

Valid would mean instead def valid = HSEL && HTRANS(1)

i guess ?

numero-744 commented 2 years ago

fire is already defined as HSEL && HREADYOUT

Dolu1990 commented 2 years ago

Ahhh right. AHB hell <3 Quite a few bad memories are lying there XD

numero-744 commented 2 years ago

So is valid a valid name? (no pun indented)

EDIT: Do you validate valid as a valid name? (pun indented)