|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cmpware.cmp.Link
com.cmpware.cmp.links.SharedRegister
public class SharedRegister
This class implements a shared register. This is a single register which has a semaphored read / write. This register may be mapped to a memory address or to a special instruction in the processor. To better support a multiprocessor communication environment, this shared registers have some specific properties. First, the register uses hardware semaphores. A write sets the the semaphore and a read clears it. Methods are provided to see if registers are currently readable / writable. This lets reliable, synchronized communication to be performed via these registers. Finally, all data written to registers is "shadowed" until a "commit" call is made. This is necessary in multiprocessor simulation environments to assure that proper clock boundaries are preserved.
Copyright (c) 2004 Cmpware, Inc. All Rights Reserved.
| Field Summary | |
|---|---|
static java.lang.String |
copyright
Copyright string |
protected MemoryMappedIOException |
mmioe
A Shared Register Execption (so we don't have to keep re-allocating them) |
protected int |
readAddr
The read address (for information only) |
protected int |
readCount
The number of reads |
protected int |
readStallCount
The number of read stalls |
protected long |
shreg
The shared register |
protected long |
shregShadow
The shared shadow registers |
protected int |
writeAddr
The write address (for information only) |
protected int |
writeCount
The number of writes |
protected int |
writeStallCount
The number of write stalls |
| Constructor Summary | |
|---|---|
SharedRegister()
|
|
| Method Summary | |
|---|---|
protected long |
clear(long i)
This method clears a semaphore in a register value. |
int |
getReadAddress()
This method returns the processor address to which the read port of this Memory Mapped IO is mapped. |
int |
getReadCount()
This method returns the number of times the read port has been accessed. |
int |
getReadStallCount()
This method returns the number of times the read port has stalled. |
int |
getValue()
This method returns the most recently written value of the Memory Mapped IO. |
int |
getWriteAddress()
This method returns the processor address to which the write port of this Memory Mapped IO is mapped. |
int |
getWriteCount()
This method returns the number of times the write port has been accessed. |
int |
getWriteStallCount()
This method returns the number of times the write port has stalled. |
boolean |
isReadable()
This method returns a true if the Memory Mapped IO is currently readable. |
protected boolean |
isSet(long i)
This method tests to see if the semaphore for the register is set. |
boolean |
isWriteable()
This method returns a true if the Memory Mapped IO port is currently writeable. |
int |
read()
This method reads a value from the Memory Mapped IO port. |
void |
readCommit()
All Memory Mapped IO reads are performed whenever data is available. |
void |
reset()
This abstract class is used to reset the link. |
protected long |
set(long i)
This method sets a semaphore in a register value. |
void |
setReadAddress(int addr)
This method sets the read address of the Memeory Mapped IO. |
void |
setWriteAddress(int addr)
This method sets the write address of the Memory Mapped IO. |
void |
write(int val)
This method writes a word to the Memory Mapped IO. |
void |
writeCommit()
All Memory Mapped IO writes are performed whenever data is available. |
| Methods inherited from class com.cmpware.cmp.Link |
|---|
get, setBufferSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String copyright
protected long shreg
protected long shregShadow
protected int readAddr
protected int writeAddr
protected int readCount
protected int writeCount
protected int readStallCount
protected int writeStallCount
protected MemoryMappedIOException mmioe
| Constructor Detail |
|---|
public SharedRegister()
| Method Detail |
|---|
public void reset()
MemoryMappedIOReader
public void write(int val)
throws MemoryMappedIOException
MemoryMappedIOWriter
val - The value to write to the Memory Mapped IO.
MemoryMappedIOException - - this method throws
a MemoryMappedIOException if the write could not
be completed on this cycle. This will typically
cause a stall of the processor and a retry on the
next cycle.
public int read()
throws MemoryMappedIOException
MemoryMappedIOReader
MemoryMappedIOException - - this method throws
a MemoryMappedIOException if the read could not
be completed on this cycle. This will typically
cause a stall of the processor and a retry on the
next cycle.public void writeCommit()
MemoryMappedIOWriter
public void readCommit()
MemoryMappedIOReader
public void setReadAddress(int addr)
MemoryMappedIOReader
addr - The Memory Mapped IO read address.public int getReadAddress()
MemoryMappedIOReader
public int getReadCount()
MemoryMappedIOReader
public int getReadStallCount()
MemoryMappedIOReader
public void setWriteAddress(int addr)
MemoryMappedIOWriter
addr - The Memory Mapped IO write address.public int getWriteAddress()
MemoryMappedIOWriter
public int getWriteCount()
MemoryMappedIOWriter
public int getWriteStallCount()
MemoryMappedIOWriter
public int getValue()
MemoryMappedIOReader
public boolean isReadable()
MemoryMappedIOReader
public boolean isWriteable()
MemoryMappedIOWriter
protected boolean isSet(long i)
protected long set(long i)
i - The value on which to set the semaphore.
protected long clear(long i)
i - The value on which to clear the semaphore.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||