This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_unit.vhd
722 lines (695 loc) · 24.9 KB
/
control_unit.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.opcodes.all;
entity control_unit is
generic (width : integer);
port (
clock : in std_logic;
reset : in std_logic;
write : out std_logic;
PC_Load : out std_logic;
PC_Inc : out std_logic;
PC : in std_logic_vector(width-1 downto 0);
IR_Load : out std_logic;
IR : in std_logic_vector(width-1 downto 0);
MAR_Load : out std_logic;
A_Load : out std_logic;
B_Load : out std_logic;
ALU_Sel : out std_logic_vector(2 downto 0);
CCR_Load : out std_logic;
CCR : in std_logic_vector(3 downto 0);
Bus1_Sel : out std_logic_vector(1 downto 0);
Bus2_Sel : out std_logic_vector(1 downto 0)
);
end entity;
architecture control_unit_arch of control_unit is
-- FSM state type
type State_Type is (
FETCH_0, FETCH_1, FETCH_2,
DECODE_3,
LDA_IMM_4, LDA_IMM_5, LDA_IMM_6,
LDA_DIR_4, LDA_DIR_5, LDA_DIR_6, LDA_DIR_7, LDA_DIR_8,
LDB_IMM_4, LDB_IMM_5, LDB_IMM_6,
LDB_DIR_4, LDB_DIR_5, LDB_DIR_6, LDB_DIR_7, LDB_DIR_8,
STA_DIR_4, STA_DIR_5, STA_DIR_6, STA_DIR_7,
STB_DIR_4, STB_DIR_5, STB_DIR_6, STB_DIR_7,
ADD_AB_4, SUB_AB_4, AND_AB_4, OR_AB_4,
INCA_4, INCB_4, DECA_4, DECB_4,
BRA_4, BRA_5, BRA_6,
BMI_4, BMI_5, BMI_6, BMI_7,
BPL_4, BPL_5, BPL_6, BPL_7,
BEQ_4, BEQ_5, BEQ_6, BEQ_7,
BNE_4, BNE_5, BNE_6, BNE_7,
BVS_4, BVS_5, BVS_6, BVS_7,
BVC_4, BVC_5, BVC_6, BVC_7,
BCS_4, BCS_5, BCS_6, BCS_7,
BCC_4, BCC_5, BCC_6, BCC_7,
HALT_99
);
signal CurrentState, NextState : State_Type;
begin
-- Control FSM
STATE_MEMORY_PROC : process(clock, reset)
begin
if reset = '0' then
CurrentState <= FETCH_0;
elsif rising_edge(clock) then
CurrentState <= NextState;
end if;
end process;
NEXT_STATE_PROC : process(CurrentState)
begin
case CurrentState is
when FETCH_0 => NextState <= FETCH_1;
when FETCH_1 => NextState <= FETCH_2;
when FETCH_2 => NextState <= DECODE_3;
when DECODE_3 =>
case IR is
-- Loads and stores
when LDA_IMM => NextState <= LDA_IMM_4;
when LDA_DIR => NextState <= LDA_DIR_4;
when LDB_IMM => NextState <= LDB_IMM_4;
when LDB_DIR => NextState <= LDB_DIR_4;
when STA_DIR => NextState <= STA_DIR_4;
when STB_DIR => NextState <= STB_DIR_4;
-- Arithmetic
when ADD_AB => NextState <= ADD_AB_4;
when SUB_AB => NextState <= SUB_AB_4;
when AND_AB => NextState <= AND_AB_4;
when OR_AB => NextState <= OR_AB_4;
when INCA => NextState <= INCA_4;
when INCB => NextState <= INCB_4;
when DECA => NextState <= DECA_4;
when DECB => NextState <= DECB_4;
-- Branching
when BRA => NextState <= BRA_4;
when BMI => if CCR(3) = '1' then NextState <= BMI_4;
else NextState <= BMI_7;
end if;
when BPL => if CCR(3) = '0' then NextState <= BPL_4;
else NextState <= BPL_7;
end if;
when BEQ => if CCR(2) = '1' then NextState <= BEQ_4;
else NextState <= BEQ_7;
end if;
when BNE => if CCR(2) = '0' then NextState <= BNE_4;
else NextState <= BNE_7;
end if;
when BVS => if CCR(1) = '1' then NextState <= BVS_4;
else NextState <= BVS_7;
end if;
when BVC => if CCR(1) = '0' then NextState <= BVC_4;
else NextState <= BVC_7;
end if;
when BCS => if CCR(0) = '1' then NextState <= BCS_4;
else NextState <= BCS_7;
end if;
when BCC => if CCR(0) = '0' then NextState <= BCC_4;
else NextState <= BCC_7;
end if;
-- A no-op restarts the fetch cycle
when NOP => NextState <= FETCH_0;
-- Handle HALT and invalid opcodes by halting
when HALT => NextState <= HALT_99;
when others => NextState <= HALT_99;
end case;
-- Load A Immediate
when LDA_IMM_4 => NextState <= LDA_IMM_5;
when LDA_IMM_5 => NextState <= LDA_IMM_6;
-- Load A Direct
when LDA_DIR_4 => NextState <= LDA_DIR_5;
when LDA_DIR_5 => NextState <= LDA_DIR_6;
when LDA_DIR_6 => NextState <= LDA_DIR_7;
when LDA_DIR_7 => NextState <= LDA_DIR_8;
-- Load B Immediate
when LDB_IMM_4 => NextState <= LDB_IMM_5;
when LDB_IMM_5 => NextState <= LDB_IMM_6;
-- Load B Direct
when LDB_DIR_4 => NextState <= LDB_DIR_5;
when LDB_DIR_5 => NextState <= LDB_DIR_6;
when LDB_DIR_6 => NextState <= LDB_DIR_7;
when LDB_DIR_7 => NextState <= LDB_DIR_8;
-- Store A Direct
when STA_DIR_4 => NextState <= STA_DIR_5;
when STA_DIR_5 => NextState <= STA_DIR_6;
when STA_DIR_6 => NextState <= STA_DIR_7;
-- Store B Direct
when STB_DIR_4 => NextState <= STB_DIR_5;
when STB_DIR_5 => NextState <= STB_DIR_6;
when STB_DIR_6 => NextState <= STB_DIR_7;
-- ALU instructions last only one state
-- Branch Always
when BRA_4 => NextState <= BRA_5;
when BRA_5 => NextState <= BRA_6;
-- Branch Minus
when BMI_4 => NextState <= BMI_5;
when BMI_5 => NextState <= BMI_6;
-- Branch Positive
when BPL_4 => NextState <= BPL_5;
when BPL_5 => NextState <= BPL_6;
-- Branch Equal
when BEQ_4 => NextState <= BEQ_5;
when BEQ_5 => NextState <= BEQ_6;
-- Branch Not Equal
when BNE_4 => NextState <= BNE_5;
when BNE_5 => NextState <= BNE_6;
-- Branch V Set
when BVS_4 => NextState <= BVS_5;
when BVS_5 => NextState <= BVS_6;
-- Branch V Clear
when BVC_4 => NextState <= BVC_5;
when BVC_5 => NextState <= BVC_6;
-- Branch C Set
when BCS_4 => NextState <= BCS_5;
when BCS_5 => NextState <= BCS_6;
-- Branch C Clear
when BCC_4 => NextState <= BCC_5;
when BCC_5 => NextState <= BCC_6;
-- HALT state remains in HALT until a reset
when HALT_99 => NextState <= HALT_99;
-- Other states are at the end of their respective branches, and
-- restart the fetch cycle
when others => NextState <= FETCH_0;
end case;
end process;
OUTPUT_SIGNAL_PROC : process(CurrentState)
begin
case CurrentState is
when FETCH_0 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when FETCH_1 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when FETCH_2 =>
-- Load IR from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '1';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
-- DECODE_3 -> others Wait for registers
when LDA_IMM_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when LDA_IMM_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when LDA_IMM_6 =>
-- Load A from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when LDA_DIR_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when LDA_DIR_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when LDA_DIR_6 =>
-- Load MAR from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
-- LDA_DIR_7 -> others Wait for memory
when LDA_DIR_8 =>
-- Load A from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when LDB_IMM_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when LDB_IMM_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when LDB_IMM_6 =>
-- Load B from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '1';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when LDB_DIR_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when LDB_DIR_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when LDB_DIR_6 =>
-- Load MAR from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
-- LDB_DIR_7 -> others Wait for memory
when LDB_DIR_8 =>
-- Load B from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '1';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when STA_DIR_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when STA_DIR_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when STA_DIR_6 =>
-- Load MAR from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when STA_DIR_7 =>
-- Write A to memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "01";
Bus2_Sel <= "11";
write <= '1';
when STB_DIR_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
when STB_DIR_5 =>
-- Increment PC while waiting for memory
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when STB_DIR_6 =>
-- Load MAR from memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when STB_DIR_7 =>
-- Write B to memory
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "10";
Bus2_Sel <= "11";
write <= '1';
when ADD_AB_4 =>
-- Add B to A
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when SUB_AB_4 =>
-- Subtract B from A
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "001";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when AND_AB_4 =>
-- Logical AND A with B
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "010";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when OR_AB_4 =>
-- Logical OR A with B
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "011";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when INCA_4 =>
-- Increment A by one
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "100";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when INCB_4 =>
-- Increment B by one
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '1';
ALU_Sel <= "100";
CCR_Load <= '1';
Bus1_Sel <= "10";
Bus2_Sel <= "00";
write <= '0';
when DECA_4 =>
-- Decrement A by one
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '1';
B_Load <= '0';
ALU_Sel <= "101";
CCR_Load <= '1';
Bus1_Sel <= "01";
Bus2_Sel <= "00";
write <= '0';
when DECB_4 =>
-- Decrement B by one
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '1';
ALU_Sel <= "101";
CCR_Load <= '1';
Bus1_Sel <= "10";
Bus2_Sel <= "00";
write <= '0';
when BRA_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
-- BRA_5 -> others Wait for memory
when BRA_6 =>
-- Load PC from memory
PC_Load <= '1';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
-- Branching instructions all have the same outputs; flow is
-- controlled by next-state logic
when BMI_4 | BPL_4 | BEQ_4 | BNE_4 | BVS_4 | BVC_4 | BCS_4 | BCC_4 =>
-- Store PC to MAR
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '1';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "00";
Bus2_Sel <= "01";
write <= '0';
-- BMI_5 | BPL_5 | BEQ_5 | BNE_5 | BVS_5 | BVC_5 | BCS_5 | BCC_5 -> others Wait for memory
when BMI_6 | BPL_6 | BEQ_6 | BNE_6 | BVS_6 | BVC_6 | BCS_6 | BCC_6 =>
-- Load PC from memory
PC_Load <= '1';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "10";
write <= '0';
when BMI_7 | BPL_7 | BEQ_7 | BNE_7 | BVS_7 | BVC_7 | BCS_7 | BCC_7 =>
-- Increment PC
PC_Load <= '0';
PC_Inc <= '1';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
when others =>
-- Do nothing (set all signals to defaults)
PC_Load <= '0';
PC_Inc <= '0';
IR_Load <= '0';
MAR_Load <= '0';
A_Load <= '0';
B_Load <= '0';
ALU_Sel <= "000";
CCR_Load <= '0';
Bus1_Sel <= "11";
Bus2_Sel <= "11";
write <= '0';
end case;
end process;
end architecture;