-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af3e49d
commit 7536223
Showing
3 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module vga_top_apb( | ||
input clock, | ||
input reset, | ||
input [31:0] in_paddr, | ||
input in_psel, | ||
input in_penable, | ||
input [2:0] in_pprot, | ||
input in_pwrite, | ||
input [31:0] in_pwdata, | ||
input [3:0] in_pstrb, | ||
output in_pready, | ||
output [31:0] in_prdata, | ||
output in_pslverr, | ||
|
||
output [7:0] vga_r, | ||
output [7:0] vga_g, | ||
output [7:0] vga_b, | ||
output vga_hsync, | ||
output vga_vsync, | ||
output vga_valid | ||
); | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package ysyx | ||
|
||
import chisel3._ | ||
import chisel3.util._ | ||
|
||
import freechips.rocketchip.amba.apb._ | ||
import org.chipsalliance.cde.config.Parameters | ||
import freechips.rocketchip.diplomacy._ | ||
import freechips.rocketchip.util._ | ||
|
||
class VGAIO extends Bundle { | ||
val r = Output(UInt(8.W)) | ||
val g = Output(UInt(8.W)) | ||
val b = Output(UInt(8.W)) | ||
val hsync = Output(Bool()) | ||
val vsync = Output(Bool()) | ||
val valid = Output(Bool()) | ||
} | ||
|
||
class VGACtrlIO extends Bundle { | ||
val clock = Input(Clock()) | ||
val reset = Input(Bool()) | ||
val in = Flipped(new APBBundle(APBBundleParameters(addrBits = 32, dataBits = 32))) | ||
val vga = new VGAIO | ||
} | ||
|
||
class vga_top_apb extends BlackBox { | ||
val io = IO(new VGACtrlIO) | ||
} | ||
|
||
class vgaChisel extends Module { | ||
val io = IO(new VGACtrlIO) | ||
} | ||
|
||
class APBVGA(address: Seq[AddressSet])(implicit p: Parameters) extends LazyModule { | ||
val node = APBSlaveNode(Seq(APBSlavePortParameters( | ||
Seq(APBSlaveParameters( | ||
address = address, | ||
executable = true, | ||
supportsRead = true, | ||
supportsWrite = true)), | ||
beatBytes = 4))) | ||
|
||
lazy val module = new Impl | ||
class Impl extends LazyModuleImp(this) { | ||
val (in, _) = node.in(0) | ||
val vga_bundle = IO(new VGAIO) | ||
|
||
val mvga = Module(new vga_top_apb) | ||
mvga.io.clock := clock | ||
mvga.io.reset := reset | ||
mvga.io.in <> in | ||
vga_bundle <> mvga.io.vga | ||
} | ||
} |