how to create a w64 structure in c++?

im want to try to implement a memory model for the a simulator.

so basically, the memory will be implemented as an 8 associative set array : meaning a two dimensional array where the first dimension is the 2^14 ( that is 16k) and the other is 8 ( which is the number of ways)

since this simulator is written in C++ with extensive use of x86 and x86-64 inline assembly code, i have to create a w64 structure and the array will be of that type.

each entry will have the cycle time of the simulator and the address of the instruction

can anybody help with the creation of the type and the array?
your help is highly appreciated

Recommended Answers

All 10 Replies

you mean something like this? char array[16384][8] ?

What is a w64 structure?

no..the entries will be address and cycle time...so its of type w64 ( word is 64 bites..the datapath

sorry, I have no clue what you want.

What exactly do you want?
You should explain every detail to increase your chances of getting helped by forum members ...

The first step in a project is knowing what you want, and being able to explain it to others is a measure of that. However, with this thread and your previous thread I'm beginning to see what you mean.

You wish to simulate a CPU memory cache with a 64-bit wide datapath using a hashtable. It will hold 16K 64-bit words (the value) as well as the 64-bit address and last access time. The "8" dimension is for up to 7 collisions in the table?? With descriptive gold like this:

and the other is 8 ( which is the number of ways)

it's hard to tell.

And you wish to run this simulation on a 32-bit machine, which is why you're asking about a 64-bit structure? Something like this:

struct w64 {
    unsigned low;
    unsigned high;
};

>>i have to create a w64 structure and the array will be of that type.
>>a two dimensional array where the first dimension is the 2^14 ( that is 16k) and the other is 8

So do you want something like this?

struct w64
{};

w64 buffer[16000][8];

I still don't understand what the question is ;)

how to create a w64 structure in c++?

That was his question, I don't understand it myself, but probably you and I won't ever need what he's asking for ...

if that w64 structure is what he wants, then he probably doesn't need it -- just use a 64-bit integer such as either __int64 or long long. long long buffer[16384][8] And 2^14 = 64K = 64 * 1024 = 16384, not 16000

16000 vs 16384, you're right, of course, but then that's why I qualified my first response with the words "something like this", not "do this". Doesn't really matter though, because I doubt the stack will accomodate anywhere near that number of structs and he's going to have to use dynamic memory to allocate enough space. Picky, picky, picky....... But hey, it's Friday afternoon, the weekend's on it's way and I'm feeling a bit carefree at the moment. I wonder if my wife could have put something in those brownies I had for lunch?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.