Aim:Writing a
C/C++ Program to emulate CPU Architecture (Central Bus) Develop
register, ALU level GUI to display results.
#include<iostream>
#include<graphics.h>
using namespace
std;
int main()
{
int x,y;
int poly[10];
int
gd=DETECT,gm=VGAMAX;
initgraph(&gd,&gm,NULL);
setcolor(WHITE);
poly[0]= 50;
poly[1]= 50;
poly[2]= 600;
poly[3]= 50;
poly[4]= 600;
poly[5]= 600;
poly[6]= 50;
poly[7]= 600;
poly[8]=poly[0];
poly[9]=poly[1];
drawpoly(5,poly);
rectangle(65,100,150,140);
outtextxy(95,115,"ALU");
line(150,120,180,120);
rectangle(180,100,380,140);
outtextxy(200,120,"SEQUENCE
CONTROLLER");
rectangle(410,100,550,160);
outtextxy(422,107,"GENERAL");
outtextxy(422,122,"PURPOSE");
outtextxy(422,136,"REGISTER");
rectangle(410,220,550,250);
outtextxy(422,228,"CACHE
MEMORY");
rectangle(210,180,350,220);
outtextxy(240,190,"PROGRAM");
outtextxy(240,205,"COUNTER");
line(280,140,280,180);
rectangle(65,280,200,250);
outtextxy(85,255,"INSTRUCTION");
outtextxy(85,268,"REGISTER");
rectangle(65,340,200,310);
outtextxy(85,315,"INSTRUCTION");
outtextxy(85,328,"
DECODER");
line(50,420,600,420);
line(50,450,600,450);
outtextxy(220,430,"ADDRESS
& DATA BUS");
outtextxy(190,460,"BASIC
ARCHITECTURE OF CPU");
line(105,140,105,250);
line(260,380,260,420);
line(320,380,320,420);
delay(10000);
closegraph();
return 0;
}
No comments:
Post a Comment