展开文件结构

This commit is contained in:
Ruige Lee
2025-04-02 16:40:25 +08:00
parent 6c6cce1222
commit 658d0d1ea2
7 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
package BACK
import chisel3._
import chisel3.util._
class ShareSRAMDP extends BlackBox with HasBlackBoxInline {
class ShareSRAMDPIO extends Bundle{
val addrA = Input(UInt(15.W))
val datawA = Input( UInt(8.W) )
val datarA = Output( UInt(8.W) )
val enwA = Input(Bool())
val enrA = Input(Bool())
val clockA = Input(Bool())
val addrB = Input(UInt(15.W))
val datawB = Input( UInt(8.W) )
val datarB = Output( UInt(8.W) )
val enwB = Input(Bool())
val enrB = Input(Bool())
val clockB = Input(Bool())
}
val io: MirrorSRAMDPIO = IO(new MirrorSRAMDPIO)
setInline("MirrorSRAMDP.v",
"""
| module MirrorSRAMDP(
| input [7:0] datawA,
| input [14:0] addrA,
| input enwA,
| input enrA,
| output [7:0] datarA,
| input clockA,
|
| input [7:0] datawB,
| input [14:0] addrB,
| input enwB,
| input enrB,
| output [7:0] datarB,
| input clockB
| );
|
| reg [7:0] mem[0:32767];
| reg [7:0] data_outa_reg = 8'b0;
| reg [7:0] data_outb_reg = 8'b0;
|
| assign datarA = data_outa_reg;
| assign datarB = data_outb_reg;
|
| always@( posedge clockA ) begin
| if( enrA ) begin
| end
|
| if( enwA ) begin
| mem[addrA] <= datawA;
| end else begin
| data_outa_reg <= mem[addrA];
| end
| end
|
|
| always@( posedge clockB ) begin
| if(enrB) begin
| end
|
| if( enwB ) begin
| mem[addrB] <= datawB;
| end else begin
| data_outb_reg <= mem[addrB];
| end
| end
|
| initial begin
| for( integer i = 0; i < 32768; i = i + 1 ) begin
| mem[i] = $random;
| end
| end
|
|
|endmodule
""".stripMargin)
}