Skip to content

Commit

Permalink
[ipemu] align strb to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jul 18, 2024
1 parent c602b88 commit ec9d62b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ipemu/src/AXI4SlaveAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class AXI4SlaveAgentInterface(parameter: AXI4SlaveAgentParameter) extends Bundle

class WritePayload(length: Int, dataWidth: Int) extends Bundle {
val data = Vec(length, UInt(dataWidth.W))
val strb = Vec(length, UInt((dataWidth / 8).W))
// For dataWidth <= 8, align strb to u8 for a simple C-API
val strb = Vec(length, UInt(math.max(8, dataWidth / 8).W))
}

class ReadPayload(length: Int,dataWidth: Int) extends Bundle {
Expand Down Expand Up @@ -98,7 +99,7 @@ class AXI4SlaveAgent(parameter: AXI4SlaveAgentParameter)
when(channel.WVALID && channel.WREADY) {
busy := true.B
writePayload.data(writeIdx) := channel.WDATA
writePayload.strb(writeIdx) := channel.WSTRB
writePayload.strb(writeIdx) := channel.WSTRB.pad(writePayload.strb.getWidth)
writeIdx := writeIdx + 1.U
when(channel.WLAST) {
last := true.B
Expand Down

0 comments on commit ec9d62b

Please sign in to comment.