65.9K
CodeProject 正在变化。 阅读更多。
Home

逻辑电路测试工具

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.07/5 (24投票s)

2004年3月19日

4分钟阅读

viewsIcon

71826

本项目的产品将提供一款软件工具,能够对大规模生产中的给定数字模块(一个逻辑单元)进行严格的测试。

引言

本项目的产品将提供一款软件工具,能够对大规模生产中的给定数字模块(一个逻辑单元)进行严格的测试。

如今,我们有很多测试算法,它们足够有效,可以在可容忍的误差范围内给出可靠的结果。但是,当我们的产品不允许出现任何错误时,我们选择对该产品进行严格测试,按照规范测试所有可能的输入-输出条件。在其软件需求规范(SRS)文档中,我们将该产品命名为“逻辑电路测试工具”。该 SRS 解释了要开发系统的要求和期望以及其可能的用户。

项目范围

开发的逻辑电路测试工具 (LCTT) 将对给定电路在给定输入信号集(0 或 1)在其输入引脚上的情况进行严格测试。系统将创建输入模式,这些模式将被馈送到被测电路的输入线,并捕获其输出线的输出以创建电路的真值表。 'LCTT' 软件和给定电路之间的这种通信通过计算机的 'LPT' 端口(D-25 打印机端口/并行端口)进行。

依赖项

  • 虽然该软件不会高度依赖任何类型的计算机硬件。它将能够在任何高于“386-intel”的 PC 配置上运行,但在“奔腾”配置上的性能会更快。
  • 该软件将首先开发一个数据库,其中包含一个经过手动测试并被确认为完美的杰作。之后,该软件将其他被测产品的真值表与数据库进行比较。对于任何不匹配,系统都会报告有故障的电路。
  • 该系统仅适用于无源逻辑电路,其中没有任何振荡器或电源。也不涉及振动器(vibrator)的使用。
  • 系统将待测单元视为一个黑盒子,并且不会在其内部做任何事情。它只关注输入和相应的输出关系。因此,在 I/O 结果方面彼此等效的两个不同电路将被同等对待。例如,如果被测单元的工作方式类似于 XOR 门,则系统不会检测它是一个直接的 XOR 门 IC 还是由 NAND 或 NOR 门组成的。结果将仅基于最终真值表。

产品 LCTT 简而言之

  • 该产品软件通过计算机的并行端口与一个杰作电路(其相同单元将被生产和测试)连接,以创建一个数据库真值表。
  • 然后,其他相同的单元以规定的方式连接到计算机的并行端口,并创建一个新的真值表,以便与数据库真值表进行比较。
  • 对于任何不匹配,该单元将被报告为有故障。
  • 系统软件不需要告诉故障的原因或位置。
  • 用于顺序和非顺序逻辑电路的独立模块。

用户期望/特征

  • 预计该系统的用户将接受培训,以便按照预期在被测单元和计算机的并行端口之间进行正确的连接。
  • 连接中的任何错误都可能导致系统故障或结果错误,甚至损坏计算机
  • 最好具备计算机并行端口的简要知识。
  • 在进行正确的连接后,用户需要按照系统本身提供的说明进行操作。

连接

  • 被测电路的输入线需要连接到计算机的 'LPT' 端口的输出线(引脚号)。
  • 被测电路的输出线要连接到系统的并行端口的输入线(引脚号)。

逻辑电路测试工具(C 语言程序)

#include<stdio.h>

#include<dos.h>

#include<conio.h>

#include<math.h>


const LPTI=0x379;       //Parallel Input Port address 

const LPTO=0x378;    //Parallel Output Port address 


/*(if your comupter system has been configured with some other address for
parallel I/O ports, configure this software accordingly. You may check these
addresses from your cpntrol pannel).*/

int IL,OL;
char refdata[256],data[256];

void creatPanel()    
/*generates the front panel that is shown to the user on screan with
different informations on it every time the screen is refreshed.*/
{
    clrscr();
    textattr(10);
    gotoxy(1,2);
    cprintf("___________________________________________________________\n\r");
    gotoxy(10,3);
    textattr(20);
    cprintf("              Logic Circuit Testing Tool              \r\n");
    gotoxy(1,4);
    textattr(10);
    cprintf("--------------------------------------------------\n\r");
    gotoxy(35,25);
    cprintf("The tool is developed by Mr. Deepak Jain.");
}

//----------------------------------

/*The help screen generation for user in any case of query. here we may put
the documentation  relevant information for user to use the tool*/
//----------------------------------


void help()
{
    clrscr();
    creatPanel();
    gotoxy(2,6);
    printf("The Help..");

    /*here you can give some helping tips for the user reference...!!*/

    getch();
}

//----------------------------------

/*Creation of the reference data with a good piece of the circuit whose
identical circuits are to be manufactured. The tool here sends I/P signals to
this circuit & captures the O/P and hence generates a truth table in its
database automatically.*/
//----------------------------------


void refDataCreatA()
{
int i;
int j=1;
char c;
start:    clrscr();
    creatPanel();
    textattr(15);
    gotoxy(2,6);
    cprintf("Place a pretested circuit as the Reference Circuit on the
parallel port \n\r & press 'Enter'\r\n");

/*Pre tested means already had been tested by manual means to retain the
confidence in the circuit The tool will be command to test the other circuits
w.r.t this circuit only.*/

    textattr(10);
    gotoxy(2,9);
    cprintf("For help in any confusion press 'H'.");
    c=getch();
    clrscr();
    creatPanel();
    if(c=='h'|| c=='H')
    {
        help();
        goto start;
    }
    textcolor(9);
    gotoxy(2,6);
    cprintf("Enter the number of Input Lines in the circuit: ");     

    //number of I/P lines in circuit


    scanf("%d",&IL);
    gotoxy(2,8);
    cprintf("\n\rEnter the number of Output Lines in the circuit: ");

        //number of I/P lines in circuit


    scanf("%d",&OL);
    for(i=0;i<IL;i++)
    j=j*2;
    gotoxy(2,10);
    for(i=0;i<j;i++)
    {
        outportb(LPTO,i);
        delay(2);
        refdata[i]=inportb(LPTI);
    }
}

//----------------------------------

/*Now the tool strats testing the other circuits. The tool will send input
signals to these circuits, one at a time and capture their output signal.
This output is compare with the reference data as prepared in the last step.
If the two matchs, the circuit is assumed to be a correct one, else an error
message is displayed*/
//----------------------------------



void startTest()
{
    int result=1;
    int i;
    int j=1;
    for(i=0;i<IL;i++)
    j=j*2;
    gotoxy(20,15);
    for(i=0;i<j;i++)
    {
        outportb(LPTO,i);
        delay(2);
        data[i]=inportb(LPTI);
        if(data[i]!=refdata[i])    //indicates an error.

        {
            result=0;
            break;
        }
    }
    if(result==0)
    {
        textattr(132);
        cprintf("ERROR:");
        textattr(4);
        cprintf(" The placed circuit is FAULTY...!!!");
        getch();
    }
    else
    {
        textattr(138);
        cprintf("The placed circuit is O.K.");
        getch();
    }
    textattr(9);
    gotoxy(17,22);
    cprintf("To test another circuit press any key...!!");
    gotoxy(17,23);
    cprintf("To Exit press 'Esc'");
}

//----------------------------------

/*The main program that integrates the process...!!*/
//----------------------------------


void main()
{
char c;
start1:    creatPanel();
    textattr(15);

    gotoxy(2,6);
    cprintf("Press 'A' for automatic generation of reference data.");
    gotoxy(2,9);
    textattr(10);
    cprintf("For help in any confusion press 'H'");
    c=getch();
    if(c=='h' || c== 'H')
    {    help(); goto start1;}
    else if(c=='A' || c=='a')
    refDataCreatA();
    else goto start1;
start2:    clrscr();
    creatPanel();
    textattr(73);
    gotoxy(2,6);
    cprintf("    The Reference Data has been created.    \n\r");
    textattr(2);
    gotoxy(2,8);
    cprintf("Replace the circuit with the other which is to be tested\n\r
& press Enter.\n\r");
    textcolor(10);
    cprintf("\nFor help in any confusion press 'H'.\n\r");
    c=getch();
    clrscr();
    creatPanel();
    if(c=='h'|| c=='H')
    {
        help();
        goto start2;
    }
    startTest();
    c=getch();
    if(c!=27)
    goto start2;        //Repeat the process.

}


作者已尽最大努力准备此文档。作者对本文档的准确性或完整性不做任何陈述或保证,并明确否认任何对内容适合任何特定目的的默示保证。作者对使用本文所述规则的工作或预期结果的成功不承担任何责任。对于任何(财务或其他)收益或损失或任何商业损害,作者概不负责。

© . All rights reserved.