Line 75... |
Line 75... |
sys.bus.upstl equ 0x00d
|
sys.bus.upstl equ 0x00d
|
sys.bus.uastl equ 0x00e
|
sys.bus.uastl equ 0x00e
|
sys.bus.ustl equ 0x00f
|
sys.bus.ustl equ 0x00f
|
#define DO_TEST_ASSEMBLER
|
#define DO_TEST_ASSEMBLER
|
#define LJMP_TEST
|
#define LJMP_TEST
|
|
#define EARLY_BRANCH_TEST
|
#define BREAK_TEST
|
#define BREAK_TEST
|
#define OVERFLOW_TEST
|
#define OVERFLOW_TEST
|
#define CARRY_TEST
|
#define CARRY_TEST
|
#define LOOP_TEST
|
#define LOOP_TEST
|
#define SHIFT_TEST
|
#define SHIFT_TEST
|
Line 239... |
Line 240... |
#ifdef NOONE // Testing comments after ifdef
|
#ifdef NOONE // Testing comments after ifdef
|
#else ; After else
|
#else ; After else
|
#endif /* and after endif */
|
#endif /* and after endif */
|
|
|
#ifdef LJMP_TEST
|
#ifdef LJMP_TEST
|
|
// A long jump is a 32-bit instruction followed by a 32-bit address.
|
|
// The CPU is supposed to jump to this address. At issue in this test,
|
|
// which can only really be verified by watching it in person currently,
|
|
// is how fast this branch can take place. Currently, it takes four
|
|
// clocks--not that bad.
|
|
//
|
|
// Although really long jumps, we also test some of our early branching
|
|
// forms here as well:
|
|
// 1. Add to PC
|
|
// 2. LOD (PC),PC (the long jump itself)
|
|
// 3. LDI x,PC // An early branch target not tested elsewhere
|
|
//
|
CLR R0
|
CLR R0
|
CLR R1
|
CLR R1
|
LJMP
|
LJMP
|
.dat __here__+0x0100000+4
|
.dat __here__+0x0100000+4
|
ADD 1,R0
|
ADD 1,R0
|
Line 268... |
Line 281... |
ADD 1,R0
|
ADD 1,R0
|
SUB 1,R0
|
SUB 1,R0
|
CMP 4,R0
|
CMP 4,R0
|
BNZ test_failure
|
BNZ test_failure
|
#endif
|
#endif
|
|
#ifdef EARLY_BRANCH_TEST
|
|
// Unlike the previous test, this test is going to see whether or not
|
|
// early branching messes with the pipeline.
|
|
BRA eb_a
|
|
BUSY
|
|
eb_a:
|
|
BRA eb_b
|
|
NOP
|
|
BUSY
|
|
eb_b:
|
|
BRA eb_c
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
eb_c:
|
|
BRA eb_d
|
|
NOP
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
eb_d:
|
|
BRA eb_e
|
|
NOP
|
|
NOP
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
eb_e:
|
|
NOOP
|
|
// Only problem is, I don't expect it to mess with the pipeline unless
|
|
// the pipeline is full. Therefore we are interested in something which
|
|
// is not an early branch, conflicting with early branches. So let's
|
|
// try loading our pipeline in all kinds of different configurations,
|
|
// just to see which if the conditional branch always annihilates the
|
|
// early branch as desired.
|
|
//
|
|
CLR R0
|
|
BZ ebz_a
|
|
BUSY
|
|
ebz_a:
|
|
BZ ebz_b
|
|
NOP
|
|
BUSY
|
|
ebz_b:
|
|
BZ ebz_c
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
// Let's repeat that last test, just in case the cache reloaded itself
|
|
// in the middle and we didn't get our proper test.
|
|
ebz_c:
|
|
BZ ebz_d
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
ebz_d:
|
|
BZ ebz_e
|
|
NOP
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
ebz_e:
|
|
BZ ebz_f
|
|
NOP
|
|
NOP
|
|
NOP
|
|
NOP
|
|
BUSY
|
|
ebz_f:
|
|
NOOP
|
|
#endif
|
|
|
#ifdef BREAK_TEST
|
#ifdef BREAK_TEST
|
breaktest:
|
breaktest:
|
bra breaksupervisor
|
bra breaksupervisor
|
breakuser:
|
breakuser:
|