wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes arrays help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arrays help" Watch "arrays help" New topic
Author

arrays help

johnathan smith
Greenhorn

Joined: Mar 30, 2007
Posts: 21
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:
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3462
    
  12
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.


Joanne
 
Don't get me started about those stupid light bulbs.
 
subject: arrays help