論理回路デザイン
ArchiTek home page
はじめに

シングルポートSRAM

/* **************************** MODULE PREAMBLE ********************************

        Copyright (c) 2012, ArchiTek
        This document constitutes confidential and proprietary information
        of ArchiTek. All rights reserved.
*/

// ***************************** MODULE HEADER *********************************

module singleSRAM (
        CE, RW, AD, WD, RD, CK
        );

// ************************ PARAMETER DECLARATIONS *****************************

        parameter               W       = 32;
        parameter               DR      = 9;

        parameter               M       = W/8;
        parameter               D       = 1<<DR;

// ***************************** I/O DECLARATIONS ******************************

        input                   CE;
        input                   RW;
        input   [DR-1:0]        AD;
        input   [W-1:0]         WD;
        output  [W-1:0]         RD;
        input                   CK;

// ************************** LOCAL DECLARATIONS *******************************

        reg     [W-1:0]         mem[0:D-1];
        reg     [DR-1:0]        la;

// ******************************** MODULE BODY ********************************

        always @(posedge CK)
                if (CE & !RW)
                        mem[AD] <= #1 WD;

        always @(posedge CK)
                if (CE)
                        la      <= #1 AD;

        assign RD       = mem[la];

endmodule

// **************************** FUNCTIONS and TASKS ****************************

endmodule

// *****************************************************************************
        

2ポートSRAM

/* **************************** MODULE PREAMBLE ********************************

        Copyright (c) 2012, ArchiTek
        This document constitutes confidential and proprietary information
        of ArchiTek. All rights reserved.
*/

// ***************************** MODULE HEADER *********************************

module dualSRAM (
        WE, WA, WD, RE, RA, RD, CK
        );

// ************************ PARAMETER DECLARATIONS *****************************

        parameter               W       = 32;
        parameter               DR      = 9;

        parameter               M       = W/8;
        parameter               D       = 1<<DR;

// ***************************** I/O DECLARATIONS ******************************

        input                   WE;
        input   [DR-1:0]        WA;
        input   [W-1:0]         WD;
        input                   RE;
        input   [DR-1:0]        RA;
        output  [W-1:0]         RD;
        input                   CK;

// ************************** LOCAL DECLARATIONS *******************************

        reg     [W-1:0]         mem[0:D-1];
        reg     [DR-1:0]        la;

// ******************************** MODULE BODY ********************************

        always @(posedge CK)
                if (WE)
                        mem[WA] <= #1 WD;

        always @(posedge CK)
                if (RE)
                        la      <= #1 RA;

        assign RD       = mem[la];

endmodule

// **************************** FUNCTIONS and TASKS ****************************

endmodule

// *****************************************************************************
        

回路デザイン > テスト > バススレーブ    次のページ(SRAMモデル)   このページのTOP ▲