Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create simulation models for DFFRAM #181

Open
xobs opened this issue Feb 13, 2023 · 0 comments
Open

Create simulation models for DFFRAM #181

xobs opened this issue Feb 13, 2023 · 0 comments

Comments

@xobs
Copy link

xobs commented Feb 13, 2023

It would be nice if DFFRAM contained simulation models to allow testing designs with DFFRAM without simulating the individual cells.

As an example, here is a simple model I'm using to test my design. This model passes the testbench generated by make PATTERN=tb_RAM32x32_1RW1R:

module RAM32_1RW1R  #(parameter    USE_LATCH=1,
                                    WSIZE=1 ) 
(
    input   wire                    CLK,    // FO: 4
    input   wire [WSIZE-1:0]        WE0,     // FO: 4
    input                           EN0,     // FO: 4
    input                           EN1,     // FO: 4
    input   wire [4:0]              A0,     // FO: 1
    input   wire [4:0]              A1,
    input   wire [(WSIZE*8-1):0]    Di0,     // FO: 4
    output  wire [(WSIZE*8-1):0]    Do0,
    output  wire [(WSIZE*8-1):0]    Do1  
);

    reg [31:0] backing[(WSIZE*8-1):0];

    assign Do0 = backing[A0];
    assign Do1 = backing[A1];

    generate
    for (c=0; c < WSIZE; c = c+1) begin
        always @(negedge CLK) begin
            if (WE0[c]) begin
                backing[A0][c*8+7:c*8] <= Di0[c*8+7:c*8];
            end
        end
    end
    endgenerate
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant