Discussion:
[Proj4] accessDRAM(), useless WRITE flag?
(too old to reply)
Jeremy Cowles
2008-08-10 00:21:49 UTC
Permalink
Raw Message
The spec says:

"To move data to and from a cache block, the memcpy() function should be
used."

So accessDRAM() is only for obtaining pointers to RAM. We then use those
pointers with memcpy() and that actually transfers the data. So my question
is, when would we ever use the WRITE flag for accessDRAM?

When writing data, we would use READ, to get the DEST pointer for use with
memcpy().
When reading data, we would use READ, to get the SRC pointer for use with
memcpy().

So am I missing something, or do we *never* use the WRITE mode with
accessDRAM?

Thanks,
Jeremy
Jeremy Cowles
2008-08-10 02:37:06 UTC
Permalink
Raw Message
Only one word transfers between the CPU and accessMemory(), so I can't
imagine that they want us to use memcpy() for this when dealing with 4 bytes
of data.

Can Albert or a TA please clarify?
From what I understand accessDRAM() does the memory transfer between RAM
and
the cache, and memcpy() does the transfer between the cache and the
program
itself. accessDRAM is therefore used on any read/write from/to memory, and
memcpy() is used to either update the contents of the cache with the data
passed into the accessMemory() function, or to copy the data from the
cache to
the destination passed in accessMemory().
I haven't tested this yet (busy writing a paper for another class... ugh),
but
this is what I think the spec means.
Willem
"When you are moving things between cache and physical memory, a BLOCK is
transferred, NOT just a word nor a byte."
The spec also says for write-through you write an entire block as well.
For
write-back you always write an entire block by definition (unless I got
mixed up about this). And to write a block, the spec says use memcpy().
So, I still don't see where you would use accessDRAM()...
You'll use the WRITE flag when doing Write-backs and you have dirty
data
you
want to over write.
Post by Jeremy Cowles
"To move data to and from a cache block, the memcpy() function should
be
used."
So accessDRAM() is only for obtaining pointers to RAM. We then use
those
pointers with memcpy() and that actually transfers the data. So my
question
is, when would we ever use the WRITE flag for accessDRAM?
When writing data, we would use READ, to get the DEST pointer for use
with
memcpy().
When reading data, we would use READ, to get the SRC pointer for use
with
memcpy().
So am I missing something, or do we *never* use the WRITE mode with
accessDRAM?
Thanks,
Jeremy
Jeremy Cowles
2008-08-10 02:37:49 UTC
Permalink
Raw Message
Btw, I am pretty sure that I am right. I just looked into what accessDRAM
does.
It copies data to/from memory.
This is the reason for my post. Both accessDRAM and cpymem() do the same
thing.
Jeremy Cowles
2008-08-10 04:42:25 UTC
Permalink
Raw Message
After looking into the accessDRAM() function, I think you are right. I was
under the impression that it was returning a pointer to memory, but it's
not. So the only way you can access DRAM is via that function.

And if that's the case, then you have no choice but to use it instead of
memcpy().
From what I understand accessDRAM() does the memory transfer between RAM
and
the cache, and memcpy() does the transfer between the cache and the
program
itself. accessDRAM is therefore used on any read/write from/to memory, and
memcpy() is used to either update the contents of the cache with the data
passed into the accessMemory() function, or to copy the data from the
cache to
the destination passed in accessMemory().
I haven't tested this yet (busy writing a paper for another class... ugh),
but
this is what I think the spec means.
Willem
"When you are moving things between cache and physical memory, a BLOCK is
transferred, NOT just a word nor a byte."
The spec also says for write-through you write an entire block as well.
For
write-back you always write an entire block by definition (unless I got
mixed up about this). And to write a block, the spec says use memcpy().
So, I still don't see where you would use accessDRAM()...
You'll use the WRITE flag when doing Write-backs and you have dirty
data
you
want to over write.
Post by Jeremy Cowles
"To move data to and from a cache block, the memcpy() function should
be
used."
So accessDRAM() is only for obtaining pointers to RAM. We then use
those
pointers with memcpy() and that actually transfers the data. So my
question
is, when would we ever use the WRITE flag for accessDRAM?
When writing data, we would use READ, to get the DEST pointer for use
with
memcpy().
When reading data, we would use READ, to get the SRC pointer for use
with
memcpy().
So am I missing something, or do we *never* use the WRITE mode with
accessDRAM?
Thanks,
Jeremy
Jeremy Cowles
2008-08-10 00:49:12 UTC
Permalink
Raw Message
From the spec:

"When you are moving things between cache and physical memory, a BLOCK is
transferred, NOT just a word nor a byte."

The spec also says for write-through you write an entire block as well. For
write-back you always write an entire block by definition (unless I got
mixed up about this). And to write a block, the spec says use memcpy().

So, I still don't see where you would use accessDRAM()...
You'll use the WRITE flag when doing Write-backs and you have dirty data
you
want to over write.
Post by Jeremy Cowles
"To move data to and from a cache block, the memcpy() function should be
used."
So accessDRAM() is only for obtaining pointers to RAM. We then use those
pointers with memcpy() and that actually transfers the data. So my question
is, when would we ever use the WRITE flag for accessDRAM?
When writing data, we would use READ, to get the DEST pointer for use with
memcpy().
When reading data, we would use READ, to get the SRC pointer for use with
memcpy().
So am I missing something, or do we *never* use the WRITE mode with
accessDRAM?
Thanks,
Jeremy
Loading...