la.c 1.88 KB
/**************************************************************************
 *									  *
 *		 Copyright (C) 1993, Silicon Graphics, Inc.		  *
 *									  *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright law.  They  may  not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *									  *
 **************************************************************************/

/*
 *  la.c $Revision: 1.1.1.1 $
 *
 *  8/1/94  RJM  Simplified logic analyzer, just do simple dumps
 *  8/7/94  RJM  Make to work with new pointer passing
 */

#include "la.h"

void
  la(la_t **pp0, la_t **pp1)
{
    int i;
    char str[256];
    la_t *p0, *p1;

    p0 = *pp0;
    p1 = *pp1;

    if(p1->n_trace > 0)
    {
	    for(i = 0;i < p1->n_trace; i++)
	    {
		sprintf(str,"%%0%dx ",(p1->trace[i].size+3)/4);
		printf(str,p0->trace[i].value);
	    }
	    printf("\n");
    }

    /* if(p1->time > 10000)
      p1->exit = 1; */

    p1->time = p1->time + 1;
}



void
  la_init(la_t *p0, la_t *p1)
{
    int i,j,k;
    int stop[64];

    /* print signal names vertically */
    for(i=0;i<p1->n_trace;i++)
        stop[i] = 0;

    if(p1->n_trace>0) for(j=0;1;j++)
    {
	for(i=0;i<p1->n_trace;i++)
	{
	    if(stop[i]==0)
	    {
		if(p1->trace[i].name[j]==0)
		{
		    stop[i] = 1;
		    printf(" ");
		}
		else
		    printf("%c",p1->trace[i].name[j]);
	    }
	    else
		printf(" ");
	    for(k=0;k<(p1->trace[i].size+3)/4;k++)
		printf(" ");
	}
	printf("\n");
	for(i=0;i<p1->n_trace;i++)
	    if(stop[i]==0)
		break;
	if(i==p1->n_trace)
	    break;
    }

    p0->time = p1->time = 0;
    p0->exit = p1->exit = 0;
    p0->gclk = p1->gclk = 0;
    p0->gclk_old = p1->gclk_old = 0;

}