Forums Register Login

arrays help

+Pie Number of slices to send: Send
hi,

im trying to write a program to represent a memory and a cache

i have written a class for the memory containing a 2d array holding random integers - i will post the code for this below for you to gain an understanding

i now wish to write a cache class which contains 4 2d arrays

32x1 for validity bit (0 if the corresponding cache block is empty, 1 if it has stuff in)
32x1 for index
32x1 for tag
32x8 for the actual cache blocks

however, i am unsure of how to go about doing this
if anybody could offer any help or psuedo code id appreciate it very much

thanks

the code for the memory class is as follows:
+Pie Number of slices to send: Send
You obviously know how to create arrays, so what problem are you having ?

Having said that though, rather than having four arrays to handle the different elements of a cache entry, you should create a new class called CacheEntry which contains fields to represent each of the elements.
Your Cache class will then contain a one dimensional array of CacheEntry objects.

Have a go at implementing that and if you have any problems, come back with your code and we'll try and help.
Alas, poor Yorick, he knew this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 676 times.
Similar Threads
display error
methods help
memory to cache problem
Cache program in Java
Can I pass an array of ints to a class?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:50:50.