File indexing completed on 2024-05-05 05:46:09

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef RAM_H
0012 #define RAM_H
0013 
0014 #include "component.h"
0015 #include "logic.h"
0016 
0017 #include <QBitArray>
0018 //#include <q3ptrvector.h>  // 2018.10.17
0019 
0020 /**
0021 @author David Saxton
0022 */
0023 class RAM : public CallbackClass, public Component
0024 {
0025 public:
0026     RAM(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0027     ~RAM() override;
0028 
0029     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0030     static LibraryItem *libraryItem();
0031 
0032 protected:
0033     void initPins();
0034     void dataChanged() override;
0035 public: // internal interfaces
0036     void inStateChanged(bool newState);
0037 protected:
0038 
0039     QBitArray m_data;
0040     LogicIn *m_pCS; // Chip select
0041     LogicIn *m_pOE; // Output enable
0042     LogicIn *m_pWE; // Write enable
0043 
0044     int m_wordSize;
0045     int m_addressSize;
0046 
0047     QVector<LogicIn *> m_address;
0048     QVector<LogicIn *> m_dataIn;
0049     QVector<LogicOut *> m_dataOut;
0050 };
0051 
0052 #endif