- •Course project handbook on “Programming” Donetsk, DonNtu, 2012
- •Contents
- •Introduction
- •1 Technical task
- •Technical task
- •2 Analyses of virtual computer
- •2.1 General architecture
- •2.2 Memory organizations. Data formats. Addressing modes
- •3 Programming in code of virtual computer
- •3.1 Programming in code of One-address Virtual Computer
- •3.2 Programming in code of Two-address Virtual Computer
- •3.3 Programming in code of Three-address Virtual Computer
- •4 Simulation program developing
- •4.3 Alu simulation and visualization
- •Void alu(int cop)
- •Appendix a general requests to the reports’ preparing
- •1. Program documentation
- •1.2. Programmer’s Manual
- •Formal report example
- •Title Page example
4.3 Alu simulation and visualization
Void alu(int cop)
{
window(1,4,80,23);
textbackground(0);
clrscr();
gotoxy(5,17); cprintf("PC");
gotoxy(15,17); cprintf("IR");
gotoxy(42,17); cprintf("Flags");
gotoxy(5,5); cprintf("R1");
gotoxy(35,5); cprintf("R2");
gotoxy(20,12); cprintf("AC");
gotoxy(20,7); cprintf("----------v----------");
gotoxy(21,8); cprintf("!");
gotoxy(25,8);
switch(cop)
{
case 1: cprintf("Addition"); break;
case 2: cprintf("Substraction"); break;
case 3: cprintf("Multyplication"); break;
case 4: cprintf("Division"); break;
case 5: cprintf("Logical AND"); break;
case 6: cprintf("Logical OR"); break;
default: cprintf("Not ALU operation");
}
gotoxy(39,8); cprintf("!");
gotoxy(22,9); cprintf("-----------------");
// get operands and result
window(8,7,23,9);
textbackground(GREEN);
clrscr();
gotoxy(2,2); cprintf("000000000101"); //print 1st operand
window(38,7,53,9);
textbackground(GREEN);
clrscr();
gotoxy(2,2); cprintf("000000001000"); // print 2d operand
window(23,13,38,15);
textbackground(GREEN);
clrscr();
gotoxy(2,2); cprintf("000000001101"); // print result
window(8,19,12,21);
textbackground(MAGENTA);
clrscr();
gotoxy(2,2); cprintf("20");
window(18,19,36,21);
textbackground(MAGENTA);
clrscr();
// load instruction
gotoxy(2,2); cprintf("0001 0 0001 0001"); //print instruction
window(48,19,56,21);
textbackground(MAGENTA);
clrscr();
gotoxy(2,2); cprintf("0 0 0 0");
}
Appendix a general requests to the reports’ preparing
1. Example of the REPORT CONTENTS
Introduction
1 MEMORY ORGANIZATION
1.1 Data representation
1.2 General memory organization
1.3 Read and Write operations
1.4 Integer operand format
2 ALU ORGANIZATION
CU ORGANIZATION
3 VIRTUAL COMPUTER ___
3.1 Architecture of VC
3.2 Instruction
4 Programming in code of VC
5 SIMULATION OF VC
5.1 Memory model
5.2 ALU model
5.3 CU model
5.4 Testing of simulation program
Conclusion
References
Appendix A: Text of program
Appendix B: User Guide
Appendix C: Program definition
Appendix D: English and Russian Glossary
1. Program documentation
1.1 User’s Manual
General Information
The User’s manual should contain the following sections:
the aim of the program;
Hardware and software requirements;
User’s messages;
It’s possible to combine existing sections or to include additional parts.
Sections Contents
The Aim of the program section should contain the information related to the purpose of the program and the essential information about program operation necessary for users.
The Hardware and software requirements section should specify the minimal and/or maximal hardware and software requirements.
The Program execution section should specify the sequences of operations and commands necessary for loading, launching, execution and successful exit of the program. Here should be included the program response to these operations.
The User’s messages section should contain the complete list of user’s messages, their full text and description as well as appropriate user’s actions in responce to these messages.
It’s posssible to add tables, figures,examples and schematic diagrams that may be helpful in understanding of the program operation.
Appendixes to the User’s manual contain all related information that isn’t included to the previous sections.