release
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
// SPDX-FileCopyrightText: 2025 Umbralogic Technologies LLC d/b/a ChipFoundry and its Licensors, All Rights Reserved
|
||||
// ========================================================================================
|
||||
//
|
||||
// This software is proprietary and protected by copyright and other intellectual property
|
||||
// rights. Any reproduction, modification, translation, compilation, or representation
|
||||
// beyond expressly permitted use is strictly prohibited.
|
||||
//
|
||||
// Access and use of this software are granted solely for integration into semiconductor
|
||||
// chip designs created by you as part of ChipFoundry shuttles or ChipFoundry managed
|
||||
// production programs. It is exclusively for Umbralogic Technologies LLC d/b/a ChipFoundry production purposes, and you may
|
||||
// not modify or convey the software for any other purpose.
|
||||
//
|
||||
// DISCLAIMER: UMBRALOGIC TECHNOLOGIES LLC D/B/A CHIPFOUNDRY AND ITS LICENSORS PROVIDE THIS MATERIAL "AS IS," WITHOUT
|
||||
// WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// Umbralogic Technologies LLC d/b/a ChipFoundry reserves the right to make changes without notice. Neither Umbralogic Technologies LLC d/b/a ChipFoundry nor its
|
||||
// licensors assume any liability arising from the application or use of any product or
|
||||
// circuit described herein. Umbralogic Technologies LLC d/b/a ChipFoundry products are not authorized for use as components
|
||||
// in life-support devices.
|
||||
//
|
||||
// This license is subject to the terms of any separate agreement you have with Umbralogic Technologies LLC d/b/a ChipFoundry
|
||||
// concerning the use of this software, which shall control in case of conflict.
|
||||
|
||||
`timescale 1 ns / 1 ps
|
||||
|
||||
|
||||
`ifdef USE_POWER_PINS
|
||||
`define USE_PG_PIN
|
||||
`endif
|
||||
|
||||
module CF_SRAM_1024x32 (DO, ScanOutCC, AD, BEN, CLKin, DI, EN, R_WB, ScanInCC, ScanInDL, ScanInDR, SM, TM, WLBI, WLOFF,
|
||||
`ifdef USE_PG_PIN
|
||||
vgnd, vnb, vpb, vpwra,
|
||||
`endif
|
||||
vpwrac,
|
||||
`ifdef USE_PG_PIN
|
||||
vpwrm,
|
||||
vpwrp,
|
||||
`endif
|
||||
vpwrpc
|
||||
);
|
||||
parameter NB = 32; // Number of Data Bits
|
||||
parameter NA = 10; // Number of Address Bits
|
||||
parameter NW = 1024; // Number of WORDS
|
||||
parameter SEED = 0 ; // User can define SEED at memory instantiation by .SEED(<Some_Seed_value>)
|
||||
|
||||
output [(NB - 1) : 0] DO;
|
||||
output ScanOutCC;
|
||||
|
||||
input [(NB - 1) : 0] DI;
|
||||
input [(NB - 1) : 0] BEN;
|
||||
input [(NA - 1) : 0] AD;
|
||||
input EN;
|
||||
input R_WB;
|
||||
input CLKin;
|
||||
input WLBI;
|
||||
input WLOFF;
|
||||
input TM;
|
||||
input SM;
|
||||
input ScanInCC;
|
||||
input ScanInDL;
|
||||
input ScanInDR;
|
||||
input vpwrac;
|
||||
input vpwrpc;
|
||||
|
||||
`ifdef USE_PG_PIN
|
||||
input vgnd;
|
||||
input vpwrm;
|
||||
|
||||
`ifdef CF_SRAM_PA_SIM
|
||||
inout vpwra;
|
||||
`else
|
||||
input vpwra;
|
||||
`endif
|
||||
|
||||
|
||||
`ifdef CF_SRAM_PA_SIM
|
||||
inout vpwrp;
|
||||
`else
|
||||
input vpwrp;
|
||||
`endif
|
||||
|
||||
input vnb;
|
||||
input vpb;
|
||||
`else
|
||||
supply0 vgnd;
|
||||
supply0 vnb;
|
||||
supply1 vpwra;
|
||||
supply1 vpwrm;
|
||||
supply1 vpwrp;
|
||||
supply1 vpb;
|
||||
`endif
|
||||
|
||||
|
||||
CF_SRAM_1024x32_macro i_CF_SRAM_1024x32_macro
|
||||
(
|
||||
.DO(DO),
|
||||
.ScanOutCC(ScanOutCC),
|
||||
.AD(AD),
|
||||
.BEN(BEN),
|
||||
.CLKin(CLKin),
|
||||
.DI(DI),
|
||||
.EN(EN),
|
||||
.R_WB(R_WB),
|
||||
.ScanInCC(ScanInCC),
|
||||
.ScanInDL(ScanInDL),
|
||||
.ScanInDR(ScanInDR),
|
||||
.SM(SM),
|
||||
.TM(TM),
|
||||
.WLBI(WLBI),
|
||||
.WLOFF(WLOFF),
|
||||
`ifdef USE_PG_PIN
|
||||
.vgnd(vgnd),
|
||||
.vnb(vnb),
|
||||
.vpb(vpb),
|
||||
.vpwra(vpwra),
|
||||
`endif
|
||||
.vpwrac(vpwrac),
|
||||
`ifdef USE_PG_PIN
|
||||
.vpwrm(vpwrm),
|
||||
.vpwrp(vpwrp),
|
||||
`endif
|
||||
.vpwrpc(vpwrpc)
|
||||
);
|
||||
endmodule
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-FileCopyrightText: 2025 Umbralogic Technologies LLC d/b/a ChipFoundry and its Licensors, All Rights Reserved
|
||||
// ========================================================================================
|
||||
//
|
||||
// This software is proprietary and protected by copyright and other intellectual property
|
||||
// rights. Any reproduction, modification, translation, compilation, or representation
|
||||
// beyond expressly permitted use is strictly prohibited.
|
||||
//
|
||||
// Access and use of this software are granted solely for integration into semiconductor
|
||||
// chip designs created by you as part of ChipFoundry shuttles or ChipFoundry managed
|
||||
// production programs. It is exclusively for Umbralogic Technologies LLC d/b/a ChipFoundry production purposes, and you may
|
||||
// not modify or convey the software for any other purpose.
|
||||
//
|
||||
// DISCLAIMER: UMBRALOGIC TECHNOLOGIES LLC D/B/A CHIPFOUNDRY AND ITS LICENSORS PROVIDE THIS MATERIAL "AS IS," WITHOUT
|
||||
// WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// Umbralogic Technologies LLC d/b/a ChipFoundry reserves the right to make changes without notice. Neither Umbralogic Technologies LLC d/b/a ChipFoundry nor its
|
||||
// licensors assume any liability arising from the application or use of any product or
|
||||
// circuit described herein. Umbralogic Technologies LLC d/b/a ChipFoundry products are not authorized for use as components
|
||||
// in life-support devices.
|
||||
//
|
||||
// This license is subject to the terms of any separate agreement you have with Umbralogic Technologies LLC d/b/a ChipFoundry
|
||||
// concerning the use of this software, which shall control in case of conflict.
|
||||
|
||||
module CF_SRAM_1024x32_stub (DO, ScanOutCC, AD, BEN, CLKin, DI, EN, R_WB, ScanInCC, ScanInDL, ScanInDR, SM, TM, WLBI, WLOFF, vgnd, vnb, vpb, vpwra, vpwrac, vpwrm, vpwrp, vpwrpc);
|
||||
output [31:0] DO;
|
||||
output ScanOutCC;
|
||||
input [31:0] DI;
|
||||
input [31:0] BEN;
|
||||
input [9:0] AD;
|
||||
input EN;
|
||||
input R_WB;
|
||||
input CLKin;
|
||||
input WLBI;
|
||||
input WLOFF;
|
||||
input TM;
|
||||
input SM;
|
||||
input ScanInCC;
|
||||
input ScanInDL;
|
||||
input ScanInDR;
|
||||
input vpwrac;
|
||||
input vpwrpc;
|
||||
input vgnd;
|
||||
input vpwrm;
|
||||
|
||||
`ifdef CF_SRAM_PA_SIM
|
||||
inout vpwra;
|
||||
`else
|
||||
input vpwra;
|
||||
`endif
|
||||
|
||||
|
||||
`ifdef CF_SRAM_PA_SIM
|
||||
inout vpwrp;
|
||||
`else
|
||||
input vpwrp;
|
||||
`endif
|
||||
|
||||
input vnb;
|
||||
input vpb;
|
||||
endmodule
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,138 @@
|
||||
// SPDX-FileCopyrightText: 2025 Umbralogic Technologies LLC d/b/a ChipFoundry and its Licensors, All Rights Reserved
|
||||
// ========================================================================================
|
||||
//
|
||||
// This software is proprietary and protected by copyright and other intellectual property
|
||||
// rights. Any reproduction, modification, translation, compilation, or representation
|
||||
// beyond expressly permitted use is strictly prohibited.
|
||||
//
|
||||
// Access and use of this software are granted solely for integration into semiconductor
|
||||
// chip designs created by you as part of ChipFoundry shuttles or ChipFoundry managed
|
||||
// production programs. It is exclusively for Umbralogic Technologies LLC d/b/a ChipFoundry production purposes, and you may
|
||||
// not modify or convey the software for any other purpose.
|
||||
//
|
||||
// DISCLAIMER: UMBRALOGIC TECHNOLOGIES LLC D/B/A CHIPFOUNDRY AND ITS LICENSORS PROVIDE THIS MATERIAL "AS IS," WITHOUT
|
||||
// WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// Umbralogic Technologies LLC d/b/a ChipFoundry reserves the right to make changes without notice. Neither Umbralogic Technologies LLC d/b/a ChipFoundry nor its
|
||||
// licensors assume any liability arising from the application or use of any product or
|
||||
// circuit described herein. Umbralogic Technologies LLC d/b/a ChipFoundry products are not authorized for use as components
|
||||
// in life-support devices.
|
||||
//
|
||||
// This license is subject to the terms of any separate agreement you have with Umbralogic Technologies LLC d/b/a ChipFoundry
|
||||
// concerning the use of this software, which shall control in case of conflict.
|
||||
|
||||
// CF_SRAM_1024x32_wb_wrapper.v
|
||||
// This module instantiates a Wishbone RAM controller and a 1024x32 SRAM macro,
|
||||
// connecting them to form a complete Wishbone slave memory block.
|
||||
|
||||
// This wrapper provides a Wishbone B4 compliant slave interface.
|
||||
// It uses the ram_wb_controller to translate Wishbone transactions
|
||||
// into signals suitable for a generic 1024x32 SRAM macro.
|
||||
|
||||
`ifdef USE_POWER_PINS
|
||||
`define USE_PG_PIN
|
||||
`endif
|
||||
|
||||
// CF_SRAM_1024x32_wb_wrapper.v
|
||||
// This module instantiates a Wishbone RAM controller and a 1024x32 SRAM macro,
|
||||
// connecting them to form a complete Wishbone slave memory block.
|
||||
|
||||
// This wrapper provides a Wishbone B4 compliant slave interface.
|
||||
// It uses the ram_wb_controller to translate Wishbone transactions
|
||||
// into signals suitable for a generic 1024x32 SRAM macro.
|
||||
|
||||
module CF_SRAM_1024x32_wb_wrapper #(parameter WIDTH = 12) (
|
||||
`ifdef USE_POWER_PINS
|
||||
inout VPWR,
|
||||
inout VGND,
|
||||
`endif
|
||||
// Wishbone Bus Interface (Slave)
|
||||
input wb_clk_i, // Wishbone clock input
|
||||
input wb_rst_i, // Wishbone reset input (active high)
|
||||
input wbs_stb_i, // Wishbone strobe input (indicates valid cycle)
|
||||
input wbs_cyc_i, // Wishbone cycle input (indicates active bus cycle)
|
||||
input wbs_we_i, // Wishbone write enable input (1 for write, 0 for read)
|
||||
input [3:0] wbs_sel_i, // Wishbone byte lane select input (controls 4 byte lanes)
|
||||
input [31:0] wbs_dat_i, // Wishbone data input (data from master for writes)
|
||||
input [31:0] wbs_adr_i, // Wishbone address input (32-bit Wishbone address)
|
||||
output wbs_ack_o, // Wishbone acknowledge output (asserted for transaction completion)
|
||||
output [31:0] wbs_dat_o // Wishbone data output (data to master for reads)
|
||||
);
|
||||
|
||||
// Internal wires to connect the ram_wb_controller outputs to the CF_SRAM_1024x32 inputs,
|
||||
// and the CF_SRAM_1024x32 output to the ram_wb_controller input.
|
||||
// These signals form the SRAM-specific interface.
|
||||
wire [31:0] sram_do; // Data output from SRAM to controller
|
||||
wire [31:0] sram_di; // Data input from controller to SRAM
|
||||
wire [31:0] sram_ben; // Byte enable from controller to SRAM (32-bit, derived from wbs_sel_i)
|
||||
wire [WIDTH-3:0] sram_ad; // Address from controller to SRAM (word-aligned address), now using WIDTH
|
||||
wire sram_en; // Chip enable from controller to SRAM (active high)
|
||||
wire sram_r_wb; // Read/Write bar from controller to SRAM (1=Read, 0=Write)
|
||||
wire sram_clk_in; // Clock signal for SRAM, directly from Wishbone clock
|
||||
|
||||
// New wires for the CF_SRAM_1024x32 module's additional pins
|
||||
wire sram_scan_out_cc; // Scan chain output
|
||||
|
||||
// Instantiate the ram_wb_controller module
|
||||
// This module translates the Wishbone protocol into generic SRAM control signals.
|
||||
ram_controller_wb #(
|
||||
.WIDTH (WIDTH) // Pass the new WIDTH parameter to the controller's WIDTH parameter
|
||||
) i_ram_wb_controller (
|
||||
// Wishbone Bus Connections
|
||||
.wb_clk_i (wb_clk_i),
|
||||
.wb_rst_i (wb_rst_i),
|
||||
.wbs_stb_i (wbs_stb_i),
|
||||
.wbs_cyc_i (wbs_cyc_i),
|
||||
.wbs_we_i (wbs_we_i),
|
||||
.wbs_sel_i (wbs_sel_i),
|
||||
.wbs_dat_i (wbs_dat_i),
|
||||
.wbs_adr_i (wbs_adr_i),
|
||||
.wbs_ack_o (wbs_ack_o), // Controller generates Wishbone ACK
|
||||
.wbs_dat_o (wbs_dat_o), // Controller provides Wishbone data out
|
||||
|
||||
// SRAM Interface Connections (to be connected to the SRAM macro)
|
||||
.DO (sram_do), // Connect SRAM's Data Output to controller's DO input
|
||||
.DI (sram_di), // Connect controller's Data Input to SRAM's DI input
|
||||
.BEN (sram_ben), // Connect controller's Byte Enable to SRAM's BEN input
|
||||
.AD (sram_ad), // Connect controller's Address to SRAM's AD input
|
||||
.EN (sram_en), // Connect controller's Chip Enable to SRAM's EN input
|
||||
.R_WB (sram_r_wb), // Connect controller's Read/Write Bar to SRAM's R_WB input
|
||||
.CLKin (sram_clk_in) // Connect controller's Clock to SRAM's CLKin input
|
||||
);
|
||||
|
||||
// Instantiate the CF_SRAM_1024x32 macro
|
||||
// This is where your actual SRAM IP or memory block would be placed.
|
||||
// The dummy module definition has been removed as per your request.
|
||||
CF_SRAM_1024x32 i_sram (
|
||||
.DO (sram_do),
|
||||
.AD (sram_ad),
|
||||
.BEN (sram_ben),
|
||||
.CLKin (sram_clk_in),
|
||||
.DI (sram_di),
|
||||
.EN (sram_en),
|
||||
.R_WB (sram_r_wb),
|
||||
// Connect new pins based on the provided list
|
||||
.ScanOutCC (sram_scan_out_cc), // Output from SRAM
|
||||
.ScanInCC (1'b0), // Tie to 0 for unused scan input (example)
|
||||
.ScanInDL (1'b0), // Tie to 0 for unused scan input (example)
|
||||
.ScanInDR (1'b0), // Tie to 0 for unused scan input (example)
|
||||
.SM (1'b0), // Tie to 0 (example)
|
||||
.TM (1'b0), // Tie to 0 (example)
|
||||
.WLBI (1'b0), // Tie to 0 (example)
|
||||
.WLOFF (1'b0), // Tie to 0 (example)
|
||||
`ifdef USE_PG_PIN
|
||||
.vgnd (1'b0), // Tie to ground
|
||||
.vnb (1'b0), // Tie to ground (body bias)
|
||||
.vpb (1'b1), // Tie to VDD (body bias)
|
||||
.vpwra (1'b1), // Tie to VDD
|
||||
`endif
|
||||
.vpwrac (1'b1), // Tie to VDD
|
||||
`ifdef USE_PG_PIN
|
||||
.vpwrm (1'b1), // Tie to VDD
|
||||
.vpwrp (1'b1), // Tie to VDD
|
||||
`endif
|
||||
.vpwrpc (1'b1) // Tie to VDD
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
// SPDX-FileCopyrightText: 2024 ChipFoundry Corporation and its Licensors, All Rights Reserved
|
||||
// ========================================================================================
|
||||
//
|
||||
// This software is protected by copyright and other intellectual property
|
||||
// rights. Therefore, reproduction, modification, translation, compilation, or
|
||||
// representation of this software in any manner other than expressly permitted
|
||||
// is strictly prohibited.
|
||||
//
|
||||
// You may access and use this software, solely as provided, solely for the purpose of
|
||||
// integrating into semiconductor chip designs that you create as a part of the
|
||||
// of ChipFoundry shuttles or ChipFoundry managed production programs (and solely for use and
|
||||
// fabrication as a part of ChipFoundry production purposes and for no other purpose. You
|
||||
// may not modify or convey the software for any other purpose.
|
||||
//
|
||||
// Disclaimer: CHIPFOUNDRY AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, AND EXPRESSLY DISCLAIM
|
||||
// ANY AND ALL WARRANTIES OF ANY KIND INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. ChipFoundry reserves the right to make changes without further
|
||||
// notice to the materials described herein. Neither ChipFoundry nor any of its licensors
|
||||
// assume any liability arising out of the application or use of any product or
|
||||
// circuit described herein. ChipFoundry's products described herein are
|
||||
// not authorized for use as components in life-support devices.
|
||||
//
|
||||
// If you have a separate agreement with ChipFoundry pertaining to the use of this software
|
||||
// then that agreement shall control.
|
||||
|
||||
`ifdef USE_POWER_PINS
|
||||
`define USE_PG_PIN
|
||||
`endif
|
||||
|
||||
module CF_SRAM_1024x32_wb_wrapper #(parameter AW = 12) (
|
||||
`ifdef USE_POWER_PINS
|
||||
inout VPWR,
|
||||
inout VGND,
|
||||
`endif
|
||||
|
||||
// Wishbone Slave ports (WB MI A)
|
||||
input wb_clk_i,
|
||||
input wb_rst_i,
|
||||
input wbs_stb_i,
|
||||
input wbs_cyc_i,
|
||||
input wbs_we_i,
|
||||
input [3:0] wbs_sel_i,
|
||||
input [31:0] wbs_dat_i,
|
||||
input [31:0] wbs_adr_i,
|
||||
output wbs_ack_o,
|
||||
output [31:0] wbs_dat_o
|
||||
);
|
||||
|
||||
// ram ports
|
||||
wire [31:0] DO;
|
||||
wire [31:0] DI;
|
||||
wire [31:0] BEN;
|
||||
wire [9:0] AD;
|
||||
wire EN;
|
||||
wire R_WB;
|
||||
wire CLKin;
|
||||
|
||||
ram_wb_controller #(.AW(AW)) ram_controller(
|
||||
.wb_clk_i(wb_clk_i),
|
||||
.wb_rst_i(wb_rst_i),
|
||||
.wbs_stb_i(wbs_stb_i),
|
||||
.wbs_cyc_i(wbs_cyc_i),
|
||||
.wbs_we_i(wbs_we_i),
|
||||
.wbs_sel_i(wbs_sel_i),
|
||||
.wbs_dat_i(wbs_dat_i),
|
||||
.wbs_adr_i(wbs_adr_i),
|
||||
.wbs_ack_o(wbs_ack_o),
|
||||
.wbs_dat_o(wbs_dat_o),
|
||||
.DO(DO),
|
||||
.DI(DI),
|
||||
.BEN(BEN),
|
||||
.AD(AD),
|
||||
.EN(EN),
|
||||
.R_WB(R_WB),
|
||||
.CLKin(CLKin)
|
||||
);
|
||||
|
||||
CF_SRAM_1024x32 SRAM_0 (
|
||||
`ifdef USE_POWER_PINS
|
||||
.vgnd(VGND),
|
||||
.vnb(VGND),
|
||||
.vpb(VPWR),
|
||||
.vpwra(VPWR),
|
||||
.vpwrm(),
|
||||
.vpwrp(VPWR),
|
||||
`endif
|
||||
.vpwrac(1'b1),
|
||||
.vpwrpc(1'b1),
|
||||
// access ports
|
||||
.DO(DO),
|
||||
.DI(DI),
|
||||
.BEN(BEN),
|
||||
.AD(AD),
|
||||
.EN(EN),
|
||||
.R_WB(R_WB),
|
||||
.CLKin(CLKin),
|
||||
// scan ports
|
||||
.TM(1'b0),
|
||||
.SM(1'b0),
|
||||
.ScanInCC(1'b0),
|
||||
.ScanInDL(1'b0),
|
||||
.ScanInDR(1'b0),
|
||||
.ScanOutCC(),
|
||||
.WLBI(1'b0),
|
||||
.WLOFF(1'b0)
|
||||
);
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,127 @@
|
||||
// SPDX-FileCopyrightText: 2025 Umbralogic Technologies LLC d/b/a ChipFoundry and its Licensors, All Rights Reserved
|
||||
// ========================================================================================
|
||||
//
|
||||
// This software is proprietary and protected by copyright and other intellectual property
|
||||
// rights. Any reproduction, modification, translation, compilation, or representation
|
||||
// beyond expressly permitted use is strictly prohibited.
|
||||
//
|
||||
// Access and use of this software are granted solely for integration into semiconductor
|
||||
// chip designs created by you as part of ChipFoundry shuttles or ChipFoundry managed
|
||||
// production programs. It is exclusively for Umbralogic Technologies LLC d/b/a ChipFoundry production purposes, and you may
|
||||
// not modify or convey the software for any other purpose.
|
||||
//
|
||||
// DISCLAIMER: UMBRALOGIC TECHNOLOGIES LLC D/B/A CHIPFOUNDRY AND ITS LICENSORS PROVIDE THIS MATERIAL "AS IS," WITHOUT
|
||||
// WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// Umbralogic Technologies LLC d/b/a ChipFoundry reserves the right to make changes without notice. Neither Umbralogic Technologies LLC d/b/a ChipFoundry nor its
|
||||
// licensors assume any liability arising from the application or use of any product or
|
||||
// circuit described herein. Umbralogic Technologies LLC d/b/a ChipFoundry products are not authorized for use as components
|
||||
// in life-support devices.
|
||||
//
|
||||
// This license is subject to the terms of any separate agreement you have with Umbralogic Technologies LLC d/b/a ChipFoundry
|
||||
// concerning the use of this software, which shall control in case of conflict.
|
||||
|
||||
// ram_wb_controller.v
|
||||
// This module implements a Wishbone B4 compliant slave interface
|
||||
// for controlling a generic 32-bit wide SRAM (Static RAM).
|
||||
// It handles address decoding, byte lane enabling, data transfer,
|
||||
// and generating the Wishbone acknowledge signal.
|
||||
|
||||
module ram_controller_wb #(parameter WIDTH = 12) (
|
||||
// Wishbone Bus Interface (Slave)
|
||||
input wb_clk_i, // Wishbone clock input
|
||||
input wb_rst_i, // Wishbone reset input (active high)
|
||||
input wbs_stb_i, // Wishbone strobe input (indicates valid cycle)
|
||||
input wbs_cyc_i, // Wishbone cycle input (indicates active bus cycle)
|
||||
input wbs_we_i, // Wishbone write enable input (1 for write, 0 for read)
|
||||
input [3:0] wbs_sel_i, // Wishbone byte lane select input (controls 4 byte lanes)
|
||||
input [31:0] wbs_dat_i, // Wishbone data input (data from master for writes)
|
||||
input [31:0] wbs_adr_i, // Wishbone address input (32-bit address)
|
||||
output reg wbs_ack_o, // Wishbone acknowledge output (asserted for transaction completion)
|
||||
output [31:0] wbs_dat_o, // Wishbone data output (data to master for reads)
|
||||
|
||||
// SRAM Device Interface
|
||||
input [31:0] DO, // Data output from SRAM (data read from SRAM)
|
||||
output [31:0] DI, // Data input to SRAM (data written to SRAM)
|
||||
output [31:0] BEN, // Byte Enable for SRAM (32-bit byte enable for 32-bit data)
|
||||
output [WIDTH-3:0] AD, // Address output to SRAM (WIDTH-3 bits for word addressing)
|
||||
output EN, // Chip Enable for SRAM (active high)
|
||||
output R_WB, // Read/Write Bar for SRAM (1 for read, 0 for write)
|
||||
output CLKin // Clock input for SRAM
|
||||
);
|
||||
|
||||
// SRAM Interface Control Signal Assignments
|
||||
// These signals are driven combinatorially based on the Wishbone inputs.
|
||||
|
||||
// AD: SRAM Address Lines
|
||||
// The Wishbone bus is typically byte-addressable (32-bit words), meaning the lower 2 bits
|
||||
// of wbs_adr_i (wbs_adr_i[1:0]) select a byte within a 32-bit word.
|
||||
// The SRAM is assumed to be word-addressable.
|
||||
// Therefore, we use wbs_adr_i[WIDTH-1:2] to generate the SRAM address.
|
||||
// Example: If WIDTH=12, then AD is 10 bits wide (wbs_adr_i[11:2]).
|
||||
assign AD = wbs_adr_i[WIDTH-1:2];
|
||||
|
||||
// DI: Data Input to SRAM
|
||||
// During a Wishbone write operation, the data from the Wishbone bus (wbs_dat_i)
|
||||
// is passed directly to the SRAM's data input.
|
||||
// During a read, the value of DI does not matter for the SRAM, but it should be driven.
|
||||
assign DI = wbs_dat_i;
|
||||
|
||||
// BEN: Byte Enable for SRAM
|
||||
// This 32-bit signal controls which bytes within the 32-bit SRAM word are enabled
|
||||
// for read or write operations. It is derived from the 4-bit Wishbone byte select (wbs_sel_i).
|
||||
// Each bit of wbs_sel_i corresponds to an 8-bit byte lane:
|
||||
// wbs_sel_i[0] -> BEN[7:0] (Byte 0)
|
||||
// wbs_sel_i[1] -> BEN[15:8] (Byte 1)
|
||||
// wbs_sel_i[2] -> BEN[23:16] (Byte 2)
|
||||
// wbs_sel_i[3] -> BEN[31:24] (Byte 3)
|
||||
assign BEN = {
|
||||
{8{wbs_sel_i[3]}}, // Replicate wbs_sel_i[3] 8 times for BEN[31:24]
|
||||
{8{wbs_sel_i[2]}}, // Replicate wbs_sel_i[2] 8 times for BEN[23:16]
|
||||
{8{wbs_sel_i[1]}}, // Replicate wbs_sel_i[1] 8 times for BEN[15:8]
|
||||
{8{wbs_sel_i[0]}} // Replicate wbs_sel_i[0] 8 times for BEN[7:0]
|
||||
};
|
||||
|
||||
// EN: SRAM Chip Enable
|
||||
// The SRAM is enabled when a Wishbone bus cycle is active (wbs_cyc_i) and
|
||||
// the strobe is asserted (wbs_stb_i), indicating a valid transaction.
|
||||
assign EN = wbs_cyc_i && wbs_stb_i;
|
||||
|
||||
// R_WB: SRAM Read/Write Bar
|
||||
// This signal determines whether the SRAM performs a read or a write operation.
|
||||
// It is active high for reads and active low for writes.
|
||||
// `!wbs_we_i` means: if `wbs_we_i` is 0 (read), R_WB is 1; if `wbs_we_i` is 1 (write), R_WB is 0.
|
||||
assign R_WB = !wbs_we_i;
|
||||
|
||||
// CLKin: SRAM Clock Input
|
||||
// The SRAM clock is directly connected to the Wishbone clock.
|
||||
assign CLKin = wb_clk_i;
|
||||
|
||||
// wbs_dat_o: Wishbone Data Output
|
||||
// This output drives the data read from the SRAM back to the Wishbone bus master.
|
||||
// It is active only during a read operation (EN is asserted and it's not a write).
|
||||
// If no active read, it defaults to 32'b0. In a real hardware implementation,
|
||||
// this output would typically be tri-stated when not actively driving.
|
||||
assign wbs_dat_o = EN && !wbs_we_i ? DO : 32'b0;
|
||||
|
||||
// wbs_ack_o: Wishbone Acknowledge Output (Registered)
|
||||
// This signal indicates that the Wishbone slave (this controller) has completed
|
||||
// the current transaction. It is asserted for one clock cycle when a valid
|
||||
// Wishbone strobe and cycle are active.
|
||||
always @(posedge wb_clk_i or posedge wb_rst_i) begin
|
||||
if (wb_rst_i)
|
||||
// On reset, de-assert acknowledge.
|
||||
wbs_ack_o <= 1'b0;
|
||||
else
|
||||
// Assert ACK when a new valid Wishbone transaction starts.
|
||||
// De-assert it in the next cycle if the strobe/cycle are no longer active,
|
||||
// ensuring a single-cycle acknowledge pulse.
|
||||
if (wbs_stb_i && wbs_cyc_i)
|
||||
wbs_ack_o <= 1'b1;
|
||||
else
|
||||
wbs_ack_o <= 1'b0;
|
||||
|
||||
// if (EN & ~wbs_ack_o)
|
||||
end
|
||||
|
||||
endmodule
|
||||
Reference in New Issue
Block a user