Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

59 Zeilen
1.4KB

  1. package Core
  2. import chisel3._
  3. import chisel3.core.Input
  4. import chisel3.iotesters.PeekPokeTester
  5. /**
  6. DaisyGrids hold n daisyVecs. Unlike the daisyVecs, daisyGrids have a select signal for selecting
  7. which daisyVec to work on, but these daisyVecs can not be controlled from the outside.
  8. */
  9. class daisyGrid(rows: Int, cols: Int, dataWidth: Int) extends Module{
  10. val io = IO(new Bundle {
  11. val readEnable = Input(Bool())
  12. val dataIn = Input(UInt(dataWidth.W))
  13. val readRow = Input(UInt(8.W))
  14. val dataOut = Output(UInt(dataWidth.W))
  15. })
  16. val currentRowIndex = RegInit(UInt(8.W), 0.U)
  17. val currentColIndex = RegInit(UInt(8.W), 0.U)
  18. val memRows = Array.fill(rows){ Module(new daisyVector(cols, dataWidth)).io }
  19. val elements = rows*cols
  20. io.dataOut := 0.U
  21. for(ii <- 0 until rows){
  22. memRows(ii).readEnable := 0.U
  23. memRows(ii).dataIn := io.dataIn
  24. when(io.readRow === ii.U ){
  25. memRows(ii).readEnable := io.readEnable
  26. io.dataOut := memRows(ii).dataOut
  27. }
  28. }
  29. }
  30. class daisyGridTest(c: daisyGrid) extends PeekPokeTester(c) {
  31. poke(c.io.readEnable, 1)
  32. for(ii <- 0 until 12){
  33. poke(c.io.dataIn, ii)
  34. poke(c.io.readRow, ii/3)
  35. step(1)
  36. println("////////////////////")
  37. }
  38. poke(c.io.readEnable, 0)
  39. for(ii <- 0 until 12){
  40. peek(c.io.dataOut)
  41. poke(c.io.readRow, ii/3)
  42. step(1)
  43. println("////////////////////")
  44. }
  45. }