Ejemplo n.º 1
0
static void endSimulation(void *nu)
{
    bhmEventHandle finished = bhmGetSystemEvent(BHM_SE_END_OF_SIMULATION);
    bhmWaitEvent(finished);
    bhmMessage("I", PREFIX, "Statistics:");
    bhmPrintf("Screen updates :    %d\n", updates);
    bhmPrintf("ISA reads      :    %d\n", ISAreads);
    bhmPrintf("ISA writes     :    %d\n", ISAwrites);
}
Ejemplo n.º 2
0
static void decodeStage2 (const char *id, Uns32 base, Uns32 decLo, Uns32 decHi) {
    Uns64 addrLo = base + (decLo << 20);
    Uns64 addrHi = base + (decHi << 20);
    addrHi |= 0xfffff;

    if (addrLo <= addrHi) {
        bhmPrintf("Region %s = 0x%08x:0x%08x (kseg0/1 0x%08x:0x%08x, 0x%08x:0x%08x)\n",
                id,
                (Uns32)addrLo, (Uns32)addrHi,
                kseg0Conv(addrLo), kseg0Conv(addrHi),
                kseg1Conv(addrLo), kseg1Conv(addrHi)
                );
    } else {
        bhmPrintf("Region %s Disabled\n", id);
    }
}
static Uns32 avgCurrentByState(Uns32 state) {
  if (state == RADIO_STATE_STATE_Disabled || state == RADIO_STATE_STATE_TxDisable) return 0; // uA
  else if (state == RADIO_STATE_STATE_TxRu || state == RADIO_STATE_STATE_TxIdle) return 6500; // uA
  else if (state == RADIO_STATE_STATE_Tx) return 11000; // uA
  else {
    bhmPrintf("ERROR in avgCurrentByState - not handled state!!!\n\n");
    return 0;
  }
}
Ejemplo n.º 4
0
static void decodeStage1(const char *id, Uns32 decLo, Uns32 decHi, Uns32 *base) {
    Uns64 addrLo = decLo << 21;
    Uns64 addrHi = decHi << 21;
    addrHi |= (addrLo & 0xFF0000000ULL); // bits 35:28

    //
    // Set bits 20:0
    //
    addrHi |= 0x1fffff;
    *base = (Uns32) (addrLo & 0xFF0000000ULL);

    if (addrLo <= addrHi) {
        bhmPrintf("Region %s = 0x%08x:0x%08x (kseg0/1 0x%08x:0x%08x, 0x%08x:0x%08x)\n",
                id,
                (Uns32)addrLo, (Uns32)addrHi,
                kseg0Conv(addrLo), kseg0Conv(addrHi),
                kseg1Conv(addrLo), kseg1Conv(addrHi)
                );
    } else {
        bhmPrintf("Region %s Disabled\n", id);
    }
    return;
}
Ejemplo n.º 5
0
static void gt64120_sdram_mapping(GT64120State *s) {
    /* Update SDRAM mapping */

    // Just Print some info
    if (BHM_DIAG_LOW) {
        Uns32 base;
        bhmPrintf("Memory Decoding\n");
        decodeStage1("SCS[1:0]", s->regs[GT_SCS10LD], s->regs[GT_SCS10HD], &base);
        decodeStage2("SCS0    ", base, s->regs[GT_SCS0LD], s->regs[GT_SCS0HD]);
        decodeStage2("SCS1    ", base, s->regs[GT_SCS1LD], s->regs[GT_SCS1HD]);
        decodeStage1("SCS[3:2]", s->regs[GT_SCS32LD], s->regs[GT_SCS32HD], &base);
        decodeStage2("SCS2    ", base, s->regs[GT_SCS2LD], s->regs[GT_SCS2HD]);
        decodeStage2("SCS3    ", base, s->regs[GT_SCS3LD], s->regs[GT_SCS3HD]);

        bhmPrintf("Device Decoding\n");
        decodeStage1("CS[2:0]   ", s->regs[GT_CS20LD], s->regs[GT_CS20HD], &base);
        decodeStage2("CS0       ", base, s->regs[GT_CS0LD], s->regs[GT_CS0HD]);
        decodeStage2("CS1       ", base, s->regs[GT_CS1LD], s->regs[GT_CS1HD]);
        decodeStage2("CS2       ", base, s->regs[GT_CS2LD], s->regs[GT_CS2HD]);
        decodeStage1("CS[3]&BOOT", s->regs[GT_CS3BOOTLD], s->regs[GT_CS3BOOTHD], &base);
        decodeStage2("CS3       ", base, s->regs[GT_CS3LD], s->regs[GT_CS3HD]);
        decodeStage2("BOOT      ", base, s->regs[GT_BOOTLD], s->regs[GT_BOOTHD]);
    }
}
void printAvgCurrent() {
  bhmPrintf("RADIO AVERAGE CURRENT LOG:\n\n");

  if (stateLogSize == 0) {
    Uns32 unused __attribute__((unused));
    unused = remove("radio_avg_current.csv");
    return; // nothing to report
  }

  FILE* fp = fopen("radio_avg_current.csv", "w+");

  Uns32 i;
  for (i = 0; i < stateLogSize-1; i++) {
    Uns32 current = avgCurrentByState(stateLog[i].state);
    if (current == 0 || stateLog[i].transitionTime == stateLog[i+1].transitionTime) {
      // don't report recorded states that lasted for 0 seconds or brought no change in current
    } else {
      bhmPrintf("%f,%f - %d\n", stateLog[i].transitionTime / 1000000.0, stateLog[i+1].transitionTime / 1000000.0, current);
      fprintf(fp, "%f,%f,%d\n", stateLog[i].transitionTime / 1000000.0, stateLog[i+1].transitionTime / 1000000.0, current);
    }
  }

  fclose(fp);
}