Tammo - Try writting the address again prior to the read. csrWrite(CSR, USTORE_ADDR, addr); // Set the target address csrWrite(CSR, USTORE_DATA, 0xD8100020); // Write an instruction csrWrite(CSR, USTORE_ADDR, addr); // Set the target address AGAIN <== result = csrRead(CSR, USTORE_DATA); -----Original Message----- From: Tammo Spalink [mailto:tspalink@CS.Princeton.EDU] Sent: Thursday, June 08, 2000 1:31 PM To: ixp1200@CS.Princeton.EDU Subject: Loading MicroEngine code I have been unsuccessfully trying to write to a UEngine UStore. From what I have read in both the paper docs and the example code, the code below should write the instruction 0xD8100020 to the 0th UStore location in UEngine 0 and end with the "result" variable having the value 0xD8100020. In practice (I have printing routines in my real program) "result" is always zero. Looking at the CSR for UEngine 0, it is disabled and should be ready to go. Am I missing some other bit that need to be set? The documentation seems to suggest that the reset state (which the UE is in at startup) should be a good time to write to the UStore. Tammo ----- typedef unsigned int uint32; // The following I get from example code: #define CTX_ENABLES (0x28) #define USTORE_ADDR (0x0) #define USTORE_DATA (0x4) void csrWrite(uint32 baseAddr, uint32 offset, uint32 value) { *((volatile uint32 *)(baseAddr + offset)) = value; } int32 csrRead(uint32 baseAddr, uint32 offset) { return *((volatile uint32 *)(baseAddr + offset)); } void __main(void) { uint32 CSR = 0xB0000000; // Base address microengine 0 uint32 CTXEnablesValue; // Holds contents of CTX_ENABLES CSR state uint32 addr = 0x0; // Where in the UStore to put code uint32 result; // Ensure the UEngines are disabled CTXEnablesValue = csrRead(CSR, CTX_ENABLES); csrWrite(CSR, CTX_ENABLES, CTXEnablesValue & 0xFFFFF0FF); addr |= 0x00000400; // Set the address enable (ECS) bit csrWrite(CSR, USTORE_ADDR, addr); // Set the target address csrWrite(CSR, USTORE_DATA, 0xD8100020); // Write an instruction result = csrRead(CSR, USTORE_DATA); // This is where I expect "result" to be 0xD8100020, however it is // always equal to 0 (zero). // Enable the UEngines again (including this one) csrWrite(CSR, CTX_ENABLES, CTXEnablesValue | (1 << (7 + ueng))); } -----
No effect I am afraid. Tammo On Thu, 8 Jun 2000, "Paige, Dale W" wrote:
Tammo -
Try writting the address again prior to the read.
csrWrite(CSR, USTORE_ADDR, addr); // Set the target address csrWrite(CSR, USTORE_DATA, 0xD8100020); // Write an instruction csrWrite(CSR, USTORE_ADDR, addr); // Set the target address AGAIN <== result = csrRead(CSR, USTORE_DATA);
participants (2)
-
Paige, Dale W
-
Tammo Spalink