/* RosemaryUser.c */
#include <stdio.h>
#include "RosemaryUser.h"
/* Debugging stubs */
void ParseWirePath(cellType, name, flatWire)
CellType cellType;
String name;
FlatWire flatWire;
{
flatWire->flatCell=rootCellType;
flatWire->wireRoot=internal;
flatWire->validPath=false;
};
void CanonizeWire(cellType, flatWire, canonized)
CellType cellType;
FlatWire flatWire;
FlatWire canonized;
{
*canonized=*flatWire;
};
void PrintWirePath(cellType, flatWire)
CellType cellType;
FlatWire flatWire;
{
printf("%s", GetShortWireName(flatWire->wire));
};
/* Debugging utilities */
void RosePrintWire(cellType, roseWire)
CellType cellType;
RoseWire roseWire;
{
PrintWirePath(cellType, roseWire->flatWire);
printf(" - sd: %s", RoseDriveNames[roseWire->switchDrive]);
printf(", ud: %s", RoseDriveNames[roseWire->upDrive]);
printf(", dd: %s", RoseDriveNames[roseWire->downDrive]);
printf(", ws: %s", RoseDriveNames[roseWire->wireSize]);
printf(", wl: %s", RoseLevelNames[roseWire->wireLevel]);
};
void RosePrintTransistor(roseTransistor)
RoseTransistor roseTransistor;
{
printf(" tt: %s", transistorTypeNames[roseTransistor->transistorType]);
printf(", tc: %s", RoseDriveNames[roseTransistor->conductivity]);
};
void RoseDescribeWire(simulation, roseWire)
RoseSimulation simulation;
RoseWire roseWire;
{
RoseTransistors channels=roseWire->channels;
RoseTransistors gates=roseWire->gates;
RosePrintWire(simulation->cellType, roseWire);
printf("\n Channels\n");
while (channels) {
RoseTransistor roseTransistor=(RoseTransistor)channels->first;
RoseWire otherWire=roseTransistor->ch1;
if (otherWire==roseWire) otherWire=roseTransistor->ch2;
RosePrintTransistor(roseTransistor);
printf("\n oc: ");
RosePrintWire(simulation->cellType, otherWire);
printf("\n g: ");
RosePrintWire(simulation->cellType, roseTransistor->gate);
printf("\n");
channels=channels->rest;
};
printf(" Gates\n");
while (gates) {
RoseTransistor roseTransistor=(RoseTransistor)gates->first;
RosePrintTransistor(roseTransistor);
printf("\n c1: ");
RosePrintWire(simulation->cellType, roseTransistor->ch1);
printf("\n c2: ");
RosePrintWire(simulation->cellType, roseTransistor->ch2);
printf("\n");
gates=gates->rest;
};
};
Ref RoseDescribeAWire(key, value, context)
Ref key;
Ref value;
Ref context;
{
RoseWire roseWire=(RoseWire)value;
RoseSimulation simulation=(RoseSimulation)context;
RoseDescribeWire(simulation, roseWire);
return(value);
};
void RoseDescribeAllWires(simulation)
RoseSimulation simulation;
{
HashTableUpdate(simulation->coreToRoseWires, RoseDescribeAWire, simulation);
};
void RoseExploreDesign(simulation)
RoseSimulation simulation;
{
int c;
char rest[256];
int restIndex=0;
while (true) {
putchar('>');
c=getchar();
if (c!='\n') for (restIndex=0; ;restIndex++) {
rest[restIndex]=getchar();
if (rest[restIndex]=='\n') {
rest[restIndex]=0;
switch (c) {
case 'q' : return;
case 'd' : RoseDescribeAllWires(simulation); break;
default : printf("commands are one letter, no leading space, (d)escribe wire, (q)uit\n");
};
break;
};
if (restIndex==255) {
printf("line overflowed; 256 character maximum");
break;
};
};
};
};