virtualSoC  0.6.2
baskett
Vcsos.Komponent.CacheStack Class Reference

Public Member Functions

 CacheStack (int size, string name)
 
void Push (byte data)
 
byte Pop ()
 
void Push32 (int value)
 
int Pop32 ()
 
byte Peek ()
 
int Peek32 ()
 
override string ToString ()
 

Protected Attributes

Memory m_pCache
 

Properties

int MaxAdress [get]
 
short SP [get, set]
 

Detailed Description

Constructor & Destructor Documentation

◆ CacheStack()

Vcsos.Komponent.CacheStack.CacheStack ( int  size,
string  name 
)
89  {
90  m_pCache = new Memory (size, name);
91  m_pCache.Write ((ushort)(m_pCache.Size-1), 0); // Current Adress
92  m_pCache.Write ((ushort)(m_pCache.Size-1), 2); // Max Adresse
93  }
int Write(byte[] data, int addr=0)
Definition: Memory.cs:60
Memory m_pCache
Definition: Stack.cs:77
int Size
Definition: Memory.cs:39

Member Function Documentation

◆ Peek()

byte Vcsos.Komponent.CacheStack.Peek ( )
130  {
131  return m_pCache [(int)(SP + 1)];
132  }
short SP
Definition: Stack.cs:84
Memory m_pCache
Definition: Stack.cs:77

◆ Peek32()

int Vcsos.Komponent.CacheStack.Peek32 ( )
134  {
135  byte[] _l = new byte[4];
136 
137  for (int i = 0; i < 4; i++) {
138  _l[i] = VM.Instance.Ram [VM.Instance.CurrentCore.Register.sp+1+i];
139  }
140 
141  return _l.ToInt ();
142  }

◆ Pop()

byte Vcsos.Komponent.CacheStack.Pop ( )
103  {
104  if (SP != MaxAdress) {
105  byte b = m_pCache [(int)(++SP)];
106  m_pCache [(int)SP] = 0;
107  return b;
108  } else {
109  // INTERRUPT
110  return 0;
111  }
112  }
short SP
Definition: Stack.cs:84
Memory m_pCache
Definition: Stack.cs:77
int MaxAdress
Definition: Stack.cs:80

◆ Pop32()

int Vcsos.Komponent.CacheStack.Pop32 ( )
122  {
123  byte[] _l = new byte[4];
124  for (int i = 0; i < 4; i++)
125  _l [i] = Pop ();
126 
127  return _l.ToInt ();
128  }
byte Pop()
Definition: Stack.cs:102

◆ Push()

void Vcsos.Komponent.CacheStack.Push ( byte  data)
95  {
96  if (SP > 7) {
97  m_pCache [(int)SP] = data; SP = (short)(SP - 1);
98  } else {
99  // INTERRUPT
100  }
101  }
short SP
Definition: Stack.cs:84
Memory m_pCache
Definition: Stack.cs:77

◆ Push32()

void Vcsos.Komponent.CacheStack.Push32 ( int  value)
114  {
115  byte[] _l = value.ToBytes ();
116  Array.Reverse (_l);
117  for (int i = 0; i < _l.Length; i++)
118  Push (_l [i]);
119  //Push (0);
120  }
void Push(byte data)
Definition: Stack.cs:94

◆ ToString()

override string Vcsos.Komponent.CacheStack.ToString ( )
144  {
145  return m_pCache.ToString ();
146  }
Memory m_pCache
Definition: Stack.cs:77
override string ToString()
Definition: Memory.cs:101

Member Data Documentation

◆ m_pCache

Memory Vcsos.Komponent.CacheStack.m_pCache
protected

Property Documentation

◆ MaxAdress

int Vcsos.Komponent.CacheStack.MaxAdress
get

◆ SP

short Vcsos.Komponent.CacheStack.SP
getset

The documentation for this class was generated from the following file: