Most of the tests of the 6502 was trying each of the different addressing modes confirming that they were behaving the correct way the programming manuals defined them to be. When first testing the initial design, most of the problems resided in the datapath. For example the carry of the alu did not properly propagate. Once the few the datapath errors were ironed out, most of the remaining problems resided in the control logic. The operand decode, which is the largest state in the model, definitely had subtle problems in the decoding the instructions. The debugging tools are very useful with these kind of problems since they can quickly show an incorrect state when processing an instruction. Since there are a limited number of states, most states can be tested with simple constructed code to test each. This provides an general test of the control logic, but may not ruggedly test all the different conditionals.
Figure 7: This figure shows the memory file which is loaded by the test ram. This program tested each of the different addressing modes which was stepped through cycle by cycle to confirm that the datapath and control were working properly.
The next level of testing is test with small constructed programs that perform different operations like string searching or multiplication. These programs have a determined result can be checked after running them through the simulator. This method of testing does not require checking each instruction to see if it executed properly in the simulator. Instead we simply check the result and see if it worked correctly.
Figure 8: Program to search for the max value in an array. The benifits of working with these programs is that simply the final result can be checked and a cycle by cycle debugging is not nescessary.
After generating successful results from fairly complex programs, the CPU becomes a working implementation. Many times during the testing processes changes are made to CPU from the datapath through till the controller level. Some of the modifications made are not actual design changes however are establishing proper signal relationships so that the simulator can run properly.