OpenCores
URL https://opencores.org/ocsvn/am9080_cpu_based_on_microcoded_am29xx_bit-slices/am9080_cpu_based_on_microcoded_am29xx_bit-slices/trunk

Subversion Repositories am9080_cpu_based_on_microcoded_am29xx_bit-slices

[/] [am9080_cpu_based_on_microcoded_am29xx_bit-slices/] [trunk/] [Am9080/] [Am9080a.vhd] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 zpekic
----------------------------------------------------------------------------------
2
-- Company:  @Home
3
-- Engineer: zpekic@hotmail.com
4
-- 
5
-- Create Date:    21:42:37 10/25/2017 
6
-- Design Name: 
7
-- Module Name:    Am9080a - Structural
8
-- Project Name:         Sys9080
9
-- Target Devices: https://www.micro-nova.com/mercury
10
-- Tool versions:  Xilinx ISE 14.7 (nt)
11
-- Description:    https://en.wikichip.org/w/images/7/76/An_Emulation_of_the_Am9080A.pdf
12
--
13
-- Dependencies: 
14
--      (slightly modified) Am2909 by Stanislaw Deniziak ( http://achilles.tu.kielce.pl/Members/sdeniziak/studia-magisterskie/mikroprogramowanie-ii/materia142y-pomocnicze/am2909.vhd/view ) 
15
--      (slightly modified) Am2901 by Amr Nasr ( https://github.com/Amrnasr/AM2901 )
16
--      All other components by zpekic@hotmail.com
17
-- Revision: 
18
-- Revision 0.01 - File Created
19
-- Additional Comments: 
20
--
21
----------------------------------------------------------------------------------
22
library IEEE;
23
use IEEE.STD_LOGIC_1164.ALL;
24
--use work.mnemonics.all;
25
 
26
-- Uncomment the following library declaration if using
27
-- arithmetic functions with Signed or Unsigned values
28
--use IEEE.NUMERIC_STD.ALL;
29
 
30
-- Uncomment the following library declaration if instantiating
31
-- any Xilinx primitives in this code.
32
--library UNISIM;
33
--use UNISIM.VComponents.all;
34
 
35
entity Am9080a is
36
    Port ( DBUS : inout  STD_LOGIC_VECTOR(7 downto 0);
37
                          ABUS : out STD_LOGIC_VECTOR(15 downto 0);
38
           WAITOUT : out  STD_LOGIC;
39
           nINTA : out  STD_LOGIC;
40
           nIOR : out  STD_LOGIC;
41
           nIOW : out  STD_LOGIC;
42
           nMEMR : out  STD_LOGIC;
43
           nMEMW : out  STD_LOGIC;
44
           HLDA : out  STD_LOGIC;
45
                          INTE : out STD_LOGIC;
46
           CLK : in  STD_LOGIC;
47
           nRESET : in  STD_LOGIC;
48
                          INT: in STD_LOGIC;
49
                          READY: in STD_LOGIC;
50
                          HOLD: in STD_LOGIC;
51
                          -- debug port, not part of actual processor
52
                          -- 0: debug bus not used
53
                          -- 1: debug bus used
54
                          debug_ena: in STD_LOGIC;
55
                          -- 0: current microinstruction details appear on debug_out (processor can work!)
56
                          -- 1: register contents appears on debug_out (processor CANNOT work!)
57
           debug_sel : in  STD_LOGIC;
58
                          -- data from processor internals
59
           debug_out : out  STD_LOGIC_VECTOR (19 downto 0);
60
                          -- register selection if debug_sel == '1', otherwise ignored
61
                          --debug_reg   register value that appears on debug_out
62
                          --0                           BC
63
                          --1                           CB
64
                          --2                           DE
65
                          --3                           ED
66
                          --4                           HL
67
                          --5                           LH
68
                          --6                           -A
69
                          --7                           A-
70
                          --8                           SP (in documentation, this is marked as "not used")
71
                          --9                           not used (in documentation, this is marked as SP)
72
                          --A                           scratch pad
73
                          --B                           scratch pad
74
                          --C                           X"0038"
75
                          --D                           X"3800"
76
                          --E                           not used
77
                          --F                           PC
78
                          debug_reg : in STD_LOGIC_VECTOR(3 downto 0)
79
                );
80
end Am9080a;
81
 
82
architecture structural of Am9080a is
83
 
84
component rom512x56 is
85
    Port ( address : in  STD_LOGIC_VECTOR (8 downto 0);
86
           data : out  STD_LOGIC_VECTOR (55 downto 0)
87
                         );
88
end component;
89
 
90
component rom256x12 is
91
    Port ( address : in  STD_LOGIC_VECTOR (7 downto 0);
92
           data : out  STD_LOGIC_VECTOR (11 downto 0)
93
                        );
94
end component;
95
 
96
component rom32x8 is
97
    Port ( nCS : in STD_LOGIC;
98
           address : in STD_LOGIC_VECTOR (3 downto 0);
99
           data : out STD_LOGIC_VECTOR (4 downto 0));
100
end component;
101
 
102
component Am25LS377 is
103
    Port ( clk : in STD_LOGIC;
104
           nE : in STD_LOGIC;
105
           d : in STD_LOGIC_VECTOR (7 downto 0);
106
           q : out STD_LOGIC_VECTOR (7 downto 0));
107
end component;
108
 
109
component Am25LS374 is
110
    Port ( clk : in STD_LOGIC;
111
           nOE : in STD_LOGIC;
112
           d : in STD_LOGIC_VECTOR(7 downto 0);
113
           y : out STD_LOGIC_VECTOR(7 downto 0));
114
end component;
115
 
116
component Am25LS153 is
117
    Port ( sel : in STD_LOGIC_VECTOR (1 downto 0);
118
           n1G : in STD_LOGIC;
119
           n2G : in STD_LOGIC;
120
           in1 : in STD_LOGIC_VECTOR (3 downto 0);
121
           in2 : in STD_LOGIC_VECTOR (3 downto 0);
122
           out1 : out STD_LOGIC;
123
           out2 : out STD_LOGIC);
124
end component;
125
 
126
component Am25LS157 is
127
    Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
128
           b : in STD_LOGIC_VECTOR (3 downto 0);
129
           s : in STD_LOGIC;
130
           nG : in STD_LOGIC;
131
           y : out STD_LOGIC_VECTOR (3 downto 0));
132
end component;
133
 
134
component Am25LS257 is
135
    Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
136
           b : in STD_LOGIC_VECTOR (3 downto 0);
137
           s : in STD_LOGIC;
138
           nOE : in STD_LOGIC;
139
           y : out STD_LOGIC_VECTOR (3 downto 0));
140
end component;
141
 
142
component Am25139 is
143
    Port ( nG1 : in STD_LOGIC;
144
           B1 : in STD_LOGIC;
145
           A1 : in STD_LOGIC;
146
           nY1 : out STD_LOGIC_VECTOR (3 downto 0);
147
           nG2 : in STD_LOGIC;
148
           B2 : in STD_LOGIC;
149
           A2 : in STD_LOGIC;
150
           nY2 : out STD_LOGIC_VECTOR (3 downto 0));
151
end component;
152
 
153
component Am82S62 is
154
    Port ( p : in STD_LOGIC_VECTOR (8 downto 0);
155
           inhibit : in STD_LOGIC;
156
           even : out STD_LOGIC;
157
           odd : out STD_LOGIC);
158
end component;
159
 
160
component Am2920 is
161
    Port ( clk : in STD_LOGIC;
162
           nE : in STD_LOGIC;
163
           nCLR : in STD_LOGIC;
164
           nOE : in STD_LOGIC;
165
           d : in STD_LOGIC_VECTOR (7 downto 0);
166
           y : out STD_LOGIC_VECTOR (7 downto 0));
167
end component;
168
 
169
component Am2918 is
170
    Port ( clk : in STD_LOGIC;
171
           nOE : in STD_LOGIC;
172
           d : in STD_LOGIC_VECTOR (3 downto 0);
173
           o : out STD_LOGIC_VECTOR (3 downto 0);
174
           y : out STD_LOGIC_VECTOR (3 downto 0));
175
end component;
176
 
177
component Am2922 is
178
    Port ( clk : in STD_LOGIC;
179
           a : in STD_LOGIC;
180
           b : in STD_LOGIC;
181
           c : in STD_LOGIC;
182
           pol : in STD_LOGIC;
183
           nME : in STD_LOGIC;
184
           nRE : in STD_LOGIC;
185
           nCLR : in STD_LOGIC;
186
           nOE : in STD_LOGIC;
187
           d : in STD_LOGIC_VECTOR (7 downto 0);
188
           y : out STD_LOGIC);
189
end component;
190
 
191
-- http://www.cselettronica.com/datasheet/AM2909.pdf
192
component Am2909 is
193
        port
194
        (
195
                -- Input ports
196
                S : in std_logic_vector(1 downto 0);
197
                R,D     : in  std_logic_vector(3 downto 0);
198
                ORi     : in  std_logic_vector(3 downto 0);
199
                nFE, PUP, nRE, nZERO, nOE, CN : in std_logic;
200
                CLK  : in std_logic;
201
                -- Output ports
202
                Y       : out std_logic_vector(3 downto 0);
203
                C4      : out std_logic
204
        );
205
end component;
206
 
207
-- http://www.cselettronica.com/datasheet/AM2901.pdf
208
component am2901c is
209
    Port ( clk : in  STD_LOGIC;
210
           --rst : in  STD_LOGIC;---------------------note: not present on real device
211
           a : in  std_logic_vector (3 downto 0);---address  inputs
212
           b : in  STD_LOGIC_VECTOR (3 downto 0);---address inputs
213
           d : in  STD_LOGIC_VECTOR (3 downto 0);---direct data
214
           i : in  STD_LOGIC_VECTOR (8 downto 0);---micro instruction
215
           c_n : in  STD_LOGIC;---------------------carry in
216
           oe : in  STD_LOGIC;----------------------output enable
217
           ram0 : inout  STD_LOGIC;-----------------shift lines to ram
218
           ram3 : inout  STD_LOGIC;-----------------shift lines to ram
219
           qs0 : inout  STD_LOGIC;------------------shift lines to q
220
           qs3 : inout  STD_LOGIC;------------------shift lines to q
221
           y : out  STD_LOGIC_VECTOR (3 downto 0);-------data outputs(3-state)
222
           g_bar : out   STD_LOGIC;---------------carry generate
223
           p_bar : out  STD_LOGIC;---------------carry propagate
224
           ovr : out  STD_LOGIC;-----------------overflow
225
           c_n4 : out  STD_LOGIC;----------------carry out
226
           f_0 : out  STD_LOGIC;-----------------f = 0
227
           f3 : out  STD_LOGIC);-----------------f(3) w/o 3-state
228
end component;
229
 
230
signal current_instruction: std_logic_vector(7 downto 0);
231
signal instruction_startaddress: std_logic_vector(11 downto 0);
232
 
233
signal ma: std_logic_vector(11 downto 0);        -- microcode address
234
 
235
signal u: std_logic_vector(55 downto 0);         -- microcode output 
236
signal pl: std_logic_vector(55 downto 0);                -- microcode register
237
---------------------------------------
238
--      Bits    Length  Description I
239
---------------------------------------
240
--      0-2     3                       ALU Source (I0-I2 of the Am2901A's)
241
alias pl_alu_source: std_logic_vector(2 downto 0) is pl(2 downto 0);
242
--      3-5     3                       ALU Function (I3-I5 of the Am2901A's)
243
alias pl_alu_function: std_logic_vector(2 downto 0) is pl(5 downto 3);
244
--      6-8     3                       ALU Destination (I6-I8 of the Am2901A's)
245
alias pl_alu_destination: std_logic_vector(2 downto 0) is pl(8 downto 6);
246
--      9-12    4                       ALU "B" Address
247
alias pl_alu_b: std_logic_vector(3 downto 0) is pl(12 downto 9);
248
--      13-16   4                       ALU "A" Address
249
alias pl_alu_a: std_logic_vector(3 downto 0) is pl(16 downto 13);
250
--      17              1                       Single/Double Byte
251
alias pl_not8or16: std_logic is pl(17);
252
--      18              1                       Cn for least significant Am2901A slice
253
alias pl_carryin: std_logic is pl(18);
254
--      19              1                       Rotate and Swap Control (formatted)
255
alias pl_rotateorswap: std_logic is pl(19);
256
--      20-21   2                       Update/keep flags
257
alias pl_updateorkeepflags: std_logic_vector(1 downto 0) is pl(21 downto 20);
258
--      22              1                       "A" Address Switch
259
alias pl_aswitch: std_logic is pl(22);
260
--      23-24   2                       Am2901A Output Steering Control
261
alias pl_outputsteer: std_logic_vector(1 downto 0) is pl(24 downto 23);
262
--      25-26   2                       Data Bus Enable Control
263
alias pl_databusenable: std_logic_vector(1 downto 0) is pl(26 downto 25);
264
--      27-32   6                       HLDA, MEMW, MEMR, I/OW, I/OR, INTA (Am9080A System Control Outputs)
265
alias pl_syscontrol: std_logic_vector(5 downto 0) is pl(32 downto 27);
266
--      33              1                       "B" Address Switch
267
alias pl_bswitch: std_logic is pl(33);
268
--      34-37   4                       Condition Code Select
269
alias u_condcode: std_logic_vector(3 downto 0) is u(37 downto 34);
270
--      38              1                       Condition Code Polarity Control
271
alias u_condpolarity: std_logic is u(38);
272
--      39-41   3                       Next Instruction Select
273
alias pl_nextinstrselect: std_logic_vector(2 downto 0) is pl(41 downto 39);
274
--      42-53   12              Numerical Field
275
alias u_immediate: std_logic_vector(11 downto 0) is u(53 downto 42);
276
--      54              1                       Numerical Field to Data Bus Control
277
alias pl_immediatedatabus: std_logic is pl(54);
278
--      55              1                       Instruction Register Clock Enable
279
alias pl_instregenable: std_logic is pl(55);
280
-----------------------------------------
281
 
282
signal sequence: std_logic_vector(4 downto 0); -- sequencer output (U14)
283
 
284
signal u21_pin24, u22_pin24: std_logic;
285
signal u62_pin2, u62_pin4, u62_pin6, u62_pin10, u62_pin12: std_logic;
286
signal u63_pin7, u63_pin9: std_logic;
287
signal u64_pin4: std_logic;
288
signal u73_pin8, u73_pin6: std_logic;
289
signal u83_pin6, u83_pin8, u83_pin3: std_logic;
290
signal u91_pin12, u91_pin9, u91_pin7, u91_pin4: std_logic;
291
signal u92_pin7: std_logic;
292
signal u97_pin9: std_logic;
293
signal u112_pin6: std_logic;
294
signal u113_pin1: std_logic;
295
signal u115_pin12, u115_pin9, u115_pin7, u115_pin4: std_logic;
296
signal u125_pin4: std_logic;
297
signal u126_pin6: std_logic;
298
signal u131_pin10: std_logic;
299
signal u135_pin12: std_logic;
300
signal u5161_pin19: std_logic;
301
signal u8474_u8475_pin15: std_logic; -- joined due to opposite tri-state enable
302
 
303
--signal reset: std_logic;
304
signal interrupt_or_mask: std_logic_vector(3 downto 0);
305
 
306
signal ocl: std_logic_vector(3 downto 1);
307
signal db: std_logic_vector(3 downto 1);
308
 
309
signal t: std_logic_vector(15 downto 0); -- test conditions
310
signal flag_z:  std_logic; --is t(0);
311
signal flag_cy: std_logic; --is t(1);
312
signal flag_p:  std_logic; --is t(2);
313
signal flag_s:  std_logic; --is t(3);
314
signal flag_ac: std_logic; --is t(4);
315
signal interrupt_enabled: std_logic;
316
 
317
signal am2901_data: std_logic_vector(15 downto 0);
318
signal am2901_y: std_logic_vector(15 downto 0);
319
signal am2901_a: std_logic_vector(3 downto 0);
320
signal am2901_b: std_logic_vector(3 downto 0);
321
signal am2901_ram0, am2901_ram3, am2901_ram11, am2901_ram15: std_logic;
322
signal am2901_q0, am2901_q3, am2901_q11, am2901_q15: std_logic;
323
signal am2901_c3, am2901_c7, am2901_c11, am2901_c15: std_logic;
324
signal signal_a, signal_b, signal_c, signal_d: std_logic;
325
signal u33pin11, u34pin11, u43pin11, u44pin11: std_logic; -- f=0 outputs from Am2901 slices cannot be tied together as there is no "open collector"
326
signal am2901_f_is_0: std_logic;
327
signal am2901_f15: std_logic;
328
 
329
signal signal_rotate, signal_swap: std_logic;
330
 
331
signal bl: std_logic_vector(7 downto 0);
332
 
333
-- various debug signals
334
signal debug_register, debug_microcode: std_logic_vector(19 downto 0);
335
signal debug_alu_destination, debug_alu_function, debug_alu_source: std_logic_vector(2 downto 0);
336
signal debug_a_lop, debug_a_hop: std_logic_vector(3 downto 0);
337
signal is_debug_register_mode: std_logic;
338
 
339
begin
340
 
341
-----       debug port     --------
342
is_debug_register_mode <= debug_ena and debug_sel;
343
 
344
debug_register <= debug_reg & am2901_y;
345
debug_microcode <= ma(11 downto 0) & current_instruction;
346
 
347
debug_out <= debug_register when (is_debug_register_mode = '1') else debug_microcode;
348
-- if debugging register, feed NOP/OR/ZA to Am2901 instead of one coming from microcode ("pl" fields)
349
-- note that this interferes with the CPU operation, so the debug_ena must be explicitly enabled!
350
debug_alu_destination <= "001" when (is_debug_register_mode = '1') else pl_alu_destination; -- NOP
351
debug_alu_function <= "011" when (is_debug_register_mode = '1') else pl_alu_function; -- OR
352
debug_alu_source <= "100" when (is_debug_register_mode = '1') else pl_alu_source; -- ZA
353
debug_a_hop <= debug_reg when (is_debug_register_mode = '1') else am2901_a;
354
debug_a_lop <= debug_reg when (is_debug_register_mode = '1') else am2901_a(3 downto 1) & u63_pin7;
355
 
356
-----------------------------------
357
---     START OF FIGURE 3       ---
358
-----------------------------------     
359
 
360
        -- instruction register ---
361
        u1516: am25ls377 port map (
362
                clk => CLK,
363
                nE => pl_instregenable,
364
                d => DBUS,
365
                q => current_instruction
366
        );
367
 
368
        -- u11, u12, u13 ----------
369
        mapper_rom: rom256x12 Port map (
370
            address => current_instruction,
371
       data => instruction_startaddress(11 downto 0)
372
   );
373
 
374
        -- microcode sequencers ---
375
        interrupt_or_mask <= "1111" when (u73_pin8 = '1') else "0000";
376
 
377
        u21: am2909 port map (
378
                S(1) => sequence(1),
379
                S(0) => sequence(0),
380
                R => u_immediate(3 downto 0),
381
                D => instruction_startaddress(3 downto 0),
382
                ORi => interrupt_or_mask,
383
                nFE => sequence(3),
384
                PUP => sequence(2),
385
                nRE => '0',
386
                nZERO => nRESET,
387
                nOE => '0',
388
                CN => '1',
389
                CLK => CLK,
390
                -- Output ports
391
                Y       => ma(3 downto 0),
392
                C4      => u21_pin24
393
        );
394
 
395
        u22: am2909 port map (
396
                S(1) => sequence(1),
397
                S(0) => sequence(0),
398
                R => u_immediate(7 downto 4),
399
                D => instruction_startaddress(7 downto 4),
400
                ORi => interrupt_or_mask,
401
                nFE => sequence(3),
402
                PUP => sequence(2),
403
                nRE => '0',
404
                nZERO => nRESET,
405
                nOE => '0',
406
                CN => u21_pin24,
407
                CLK => CLK,
408
                -- Output ports
409
                Y       => ma(7 downto 4),
410
                C4      => u22_pin24
411
        );
412
 
413
        u23: am2909 port map (
414
                S(1) => sequence(1),
415
                S(0) => sequence(0),
416
                R => u_immediate(11 downto 8),
417
                D => instruction_startaddress(11 downto 8),
418
                ORi => interrupt_or_mask,
419
                nFE => sequence(3),
420
                PUP => sequence(2),
421
                nRE => '0',
422
                nZERO => nRESET,
423
                nOE => '0',
424
                CN => u22_pin24,
425
                CLK => CLK,
426
                -- Output ports
427
                Y       => ma(11 downto 8),
428
                C4      => open
429
        );
430
 
431
        --- test condition multiplexers ---
432
        u8474: am2922 port map (
433
                          clk => CLK,
434
           a => u_condcode(0),
435
           b => u_condcode(1),
436
           c => u_condcode(2),
437
           pol => u_condpolarity,
438
           nME => '0',
439
           nRE => '0',
440
           nCLR => '1',
441
           nOE => pl(37),
442
           d => t(7 downto 0),
443
           y => u8474_u8475_pin15
444
        );
445
 
446
        t(15) <= '1'; -- TRUE
447
        --t(14) <= u121_pin12; 
448
        --t(13) <= u121_pin15; 
449
        --t(12) <= u121_pin16;
450
        t(11) <= '0'; -- OPEN
451
        --t(10) <= u121_pin6;
452
        --t(9) <= u121_pin5;
453
        --t(8) <= u121_pin2;
454
        t(7) <= '0'; -- OPEN
455
        t(6) <= '0'; -- OPEN
456
        t(5) <= '0'; -- OPEN
457
        t(4) <= flag_ac;
458
        t(3) <= flag_s;
459
        t(2) <= flag_p;
460
        t(1) <= flag_cy;
461
        t(0) <= flag_z;
462
 
463
        u62_pin10 <= not pl(37);
464
 
465
        u8475: am2922 port map (
466
                          clk => CLK,
467
           a => u_condcode(0),
468
           b => u_condcode(1),
469
           c => u_condcode(2),
470
           pol => u_condpolarity,
471
           nME => '0',
472
           nRE => '0',
473
           nCLR => '1',
474
           nOE => u62_pin10,
475
           d => t(15 downto 8),
476
           y => u8474_u8475_pin15
477
        );
478
 
479
   --- sequencer rom ----
480
    u14: rom32x8 port map ( -- TODO: it is actually 16*5 only
481
        nCS => '0',
482
                  address(3 downto 1) => pl_nextinstrselect,
483
        address(0) => u8474_u8475_pin15,
484
        data(4 downto 0) => sequence
485
    );
486
 
487
        INTE <= interrupt_enabled;
488
        u73_pin8 <= interrupt_enabled and INT and sequence(4);
489
 
490
   --- microcode rom ---        
491
   microcode_rom: rom512x56 Port map (
492
        address => ma(8 downto 0),
493
        data => u
494
  );
495
 
496
  --- data bus output from microcode ---
497
  u8182: Am25LS374 port map (
498
                          clk => CLK,
499
           nOE => pl_immediatedatabus,
500
           d => u_immediate(7 downto 0),
501
           y => DBUS
502
                        );
503
 
504
   --- bus state output register ---
505
        u83_pin6 <= u8474_u8475_pin15 and (not u73_pin6);
506
 
507
   u7172: Am25LS374 port map (
508
                          clk => CLK,
509
           nOE => pl(27),
510
           d(0) => '0', -- ignored
511
           d(1) => '0', -- ignored
512
           d(2) => u83_pin6,
513
           d(3) => u(32),
514
           d(4) => u(31),
515
           d(5) => u(30),
516
           d(6) => u(29),
517
           d(7) => u(28),
518
           y(0) => open,
519
           y(1) => open,
520
           y(2) => WAITOUT,
521
           y(3) => pl(32), --nINTA,
522
           y(4) => pl(31), --nIOR,
523
           y(5) => pl(30), --nIOW,
524
           y(6) => pl(29), --nMEMR,
525
           y(7) => pl(28)  --nMEMW
526
                        );
527
        HLDA <= not pl(27);
528
        nINTA <= pl(32);
529
   nIOR <= pl(31);
530
   nIOW <= pl(30);
531
   nMEMR <= pl(29);
532
   nMEMW <= pl(28);
533
 
534
        --- microcode output register ---
535
   u3132: Am25LS374 port map (
536
                          clk => CLK,
537
           nOE => '0',
538
           d => u(7 downto 0),
539
                          y => pl(7 downto 0)
540
                        );
541
 
542
   u3241: Am25LS374 port map (
543
                          clk => CLK,
544
           nOE => '0',
545
           d => u(15 downto 8),
546
           y => pl(15 downto 8)
547
                        );
548
 
549
   u4142: Am25LS374 port map (
550
                          clk => CLK,
551
           nOE => '0',
552
           d => u(23 downto 16),
553
           y => pl(23 downto 16)
554
                        );
555
 
556
   u51: Am25LS374 port map (
557
                          clk => CLK,
558
           nOE => '0',
559
                          d(7 downto 4) => "0000", -- ignore
560
                          d(3 downto 0) => u(27 downto 24),
561
                          y(7) => open,
562
                          y(6) => open,
563
                          y(5) => open,
564
                          y(4) => open,
565
                          y(3 downto 0) => pl(27 downto 24)
566
                        );
567
 
568
        u62_pin6 <= not pl(55);
569
 
570
   u5161: Am25LS374 port map (
571
                          clk => CLK,
572
           nOE => '0',
573
           d(0) => u(37),
574
           d(1) => u(55),
575
           d(2) => u(54),
576
           d(3) => u(41),
577
           d(4) => u(40),
578
           d(5) => u(39),
579
           d(6) => u(33),
580
           d(7) => u62_pin6,
581
           y(0) => pl(37),
582
           y(1) => pl(55),
583
           y(2) => pl(54),
584
           y(3) => pl(41),
585
           y(4) => pl(40),
586
           y(5) => pl(39),
587
           y(6) => pl(33),
588
           y(7) => u5161_pin19
589
                        );
590
 
591
-----------------------------------
592
---     START OF FIGURE 4       ---
593
-----------------------------------
594
 
595
-- Data bus register ---
596
        u12324: Am25LS377 port map (
597
                                clk => CLK,
598
                                nE => u5161_pin19,
599
                                d => DBUS,
600
                                q => bl
601
        );
602
 
603
-- 2901 data mux ---
604
        u53: Am25LS157 port map (
605
                                 a => bl(3 downto 0),
606
                                 b => am2901_y(11 downto 8),
607
                                 s => signal_swap,
608
                                 nG => '0',
609
                                 y => am2901_data(3 downto 0)
610
                        );
611
 
612
        u54: Am25LS157 port map (
613
                                 a => bl(7 downto 4),
614
                                 b => am2901_y(15 downto 12),
615
                                 s => signal_swap,
616
                                 nG => '0',
617
                                 y => am2901_data(7 downto 4)
618
                        );
619
 
620
        u55: Am25LS157 port map (
621
                                 a => bl(3 downto 0),
622
                                 b => am2901_y(3 downto 0),
623
                                 s => signal_swap,
624
                                 nG => '0',
625
                                 y => am2901_data(11 downto 8)
626
                        );
627
 
628
        u56: Am25LS157 port map (
629
                                 a => bl(7 downto 4),
630
                                 b => am2901_y(7 downto 4),
631
                                 s => signal_swap,
632
                                 nG => '0',
633
                                 y => am2901_data(15 downto 12)
634
                        );
635
 
636
-- 2901 address a and b mux --
637
        u65: Am25LS157 port map (
638
                                 a => pl_alu_b,
639
                                 b(3) => '0',
640
                                 b(2 downto 0) => current_instruction(5 downto 3),
641
                                 s => pl_bswitch,
642
                                 nG => '0',
643
                                 y => am2901_b(3 downto 0)
644
                        );
645
 
646
        u66: Am25LS157 port map (
647
                                 a => pl_alu_a,
648
                                 b(3) => '0',
649
                                 b(2 downto 0) => current_instruction(2 downto 0),
650
                                 s => pl_aswitch,
651
                                 nG => '0',
652
                                 y => am2901_a(3 downto 0)
653
                        );
654
 
655
        u62_pin2 <= not am2901_a(0);
656
        u62_pin4 <= not am2901_b(0);
657
 
658
        u63: Am25LS153 port map (
659
                                  sel(1) => pl_bswitch,
660
                                  sel(0) => pl_not8or16,
661
                                  n1G => '0',
662
                                  n2G => '0',
663
                                  in1(3) => am2901_a(0),
664
                                  in1(2) => u62_pin2,
665
                                  in1(1) => am2901_a(0),
666
                                  in1(0) => u62_pin2,
667
                                  in2(3) => '0',
668
                                  in2(2) => u62_pin4,
669
                                  in2(1) => am2901_b(0),
670
                                  in2(0) => u62_pin4,
671
                                  out1 => u63_pin7, -- am2901_a(0) for LOP slices
672
                                  out2 => u63_pin9  -- am2901_b(0) for LOP slices
673
                        );
674
 
675
-- LOP slices ---
676
        u43: Am2901c port map (
677
                                  clk => CLK,
678
                                  --rst => '0', -- NOTE: specific to this implementation, real Am2901 has no reset
679
                                  a(3 downto 1) => debug_a_lop(3 downto 1), --am2901_a(3 downto 1), 
680
                                  a(0) => debug_a_lop(0), --u63_pin7,
681
                                  b(3 downto 1) => am2901_b(3 downto 1),
682
                                  b(0) => u63_pin9,
683
                                  d => am2901_data(3 downto 0),
684
                                  i(8 downto 6) => debug_alu_destination, --pl_alu_destination,
685
                                  i(5 downto 3) => debug_alu_function, --pl_alu_function,
686
                                  i(2 downto 0) => debug_alu_source, --pl_alu_source,
687
                                  c_n => pl_carryin,
688
                                  oe => '0',
689
                                  ram0 => am2901_ram0,
690
                                  ram3 => am2901_ram3,
691
                                  qs0 => am2901_q0,
692
                                  qs3 => am2901_q3,
693
                                  y => am2901_y(3 downto 0),
694
                                  g_bar => open,
695
                                  p_bar => open,
696
                                  ovr => open,
697
                                  c_n4 => am2901_c3,
698
                                  f_0 => u43pin11,
699
                                  f3 => open
700
        );
701
 
702
        u44: Am2901c port map (
703
                                  clk => CLK,
704
                                  --rst => '0', -- NOTE: specific to this implementation, real Am2901 has no reset
705
                                  a(3 downto 1) => debug_a_lop(3 downto 1), --am2901_a(3 downto 1), 
706
                                  a(0) => debug_a_lop(0), --u63_pin7,
707
                                  b(3 downto 1) => am2901_b(3 downto 1),
708
                                  b(0) => u63_pin9,
709
                                  d => am2901_data(7 downto 4),
710
                                  i(8 downto 6) => debug_alu_destination, --pl_alu_destination,
711
                                  i(5 downto 3) => debug_alu_function, --pl_alu_function,
712
                                  i(2 downto 0) => debug_alu_source, --pl_alu_source,
713
                                  c_n => am2901_c3,
714
                                  oe => '0',
715
                                  ram0 => am2901_ram3,
716
                                  ram3 => signal_c,
717
                                  qs0 => am2901_q3,
718
                                  qs3 => signal_d,
719
                                  y => am2901_y(7 downto 4),
720
                                  g_bar => open,
721
                                  p_bar => open,
722
                                  ovr => open,
723
                                  c_n4 => am2901_c7,
724
                                  f_0 => u44pin11,
725
                                  f3 => open
726
        );
727
 
728
-- HOP slices ---
729
        u33: Am2901c port map (
730
                                  clk => CLK,
731
                                  --rst => '0', -- NOTE: specific to this implementation, real Am2901 has no reset
732
                                  a => debug_a_hop, --am2901_a,
733
                                  b => am2901_b,
734
                                  d => am2901_data(11 downto 8),
735
                                  i(8 downto 6) => debug_alu_destination, --pl_alu_destination,
736
                                  i(5 downto 3) => debug_alu_function, --pl_alu_function,
737
                                  i(2 downto 0) => debug_alu_source, --pl_alu_source,
738
                                  c_n => u64_pin4,
739
                                  oe => '0',
740
                                  ram0 => signal_b,
741
                                  ram3 => am2901_ram11,
742
                                  qs0 => signal_a,
743
                                  qs3 => am2901_q11,
744
                                  y => am2901_y(11 downto 8),
745
                                  g_bar => open,
746
                                  p_bar => open,
747
                                  ovr => open,
748
                                  c_n4 => am2901_c11,
749
                                  f_0 => u33pin11,
750
                                  f3 => open
751
        );
752
 
753
        u34: Am2901c port map (
754
                                  clk => CLK,
755
                                  --rst => '0', -- NOTE: specific to this implementation, real Am2901 has no reset
756
                                  a => debug_a_hop, --am2901_a,
757
                                  b => am2901_b,
758
                                  d => am2901_data(15 downto 12),
759
                                  i(8 downto 6) => debug_alu_destination, --pl_alu_destination,
760
                                  i(5 downto 3) => debug_alu_function, --pl_alu_function,
761
                                  i(2 downto 0) => debug_alu_source, --pl_alu_source,
762
                                  c_n => am2901_c11,
763
                                  oe => '0',
764
                                  ram0 => am2901_ram11,
765
                                  ram3 => am2901_ram15,
766
                                  qs0 => am2901_q11,
767
                                  qs3 => am2901_q15,
768
                                  y => am2901_y(15 downto 12),
769
                                  g_bar => open,
770
                                  p_bar => open,
771
                                  ovr => open,
772
                                  c_n4 => am2901_c15,
773
                                  f_0 => u34pin11,
774
                                  f3 => am2901_f15
775
        );
776
 
777
        am2901_f_is_0 <= u33pin11 and u34pin11 and u43pin11 and u44pin11; -- use standard "and", not open collector.
778
 
779
        u64: Am25LS157 port map (
780
                                 a(3) => '0',
781
                                 a(2) => pl_rotateorswap,
782
                                 a(1) => pl_carryin,
783
                                 a(0) => '0', -- open 
784
 
785
                                 b(3) => pl_rotateorswap,
786
                                 b(2) => '0',
787
                                 b(1) => am2901_c7, -- open 
788
                                 b(0) => '0', -- open,
789
 
790
                                 s => pl_not8or16,
791
                                 nG => '0',
792
 
793
                                 y(3) => signal_swap,
794
                                 y(2) => signal_rotate,
795
                                 y(1) => u64_pin4,
796
                                 y(0) => open
797
                        );
798
 
799
         u62_pin12 <= not pl(7);
800
 
801
    u76: Am25LS257 port map (
802
           b(3) => am2901_q15,
803
                          b(2) => signal_d,
804
                          b(1) => flag_cy,
805
                          b(0) => flag_cy,
806
                          a(3) => signal_d,
807
                          a(2) => am2901_q15,
808
                          a(1) => signal_c,
809
                          a(0) => am2901_ram15,
810
           s => signal_rotate,
811
           nOE => u62_pin12,
812
           y(3) => am2901_q0,
813
                          y(2) => signal_a,
814
                          y(1) => am2901_ram0,
815
                          y(0) => signal_b
816
                        );
817
 
818
    u77: Am25LS257 port map (
819
                          a(3) => am2901_q0,
820
                          a(2) => signal_a,
821
                          a(1) => am2901_ram0,
822
                          a(0) => signal_b,
823
           b(3) => signal_a,
824
                          b(2) => am2901_q0,
825
                          b(1) => flag_cy,
826
                          b(0) => flag_cy,
827
           s => signal_rotate,
828
           nOE => pl(7),
829
           y(3) => signal_d,
830
                          y(2) => am2901_q15,
831
                          y(1) => signal_c,
832
                          y(0) => am2901_ram15
833
                        );
834
 
835
-----------------------------------
836
---     START OF FIGURE 5       ---
837
-----------------------------------
838
-- parity generator
839
        u97: Am82S62 port map (
840
                                p(8) => '0',
841
                                p(7 downto 0) => am2901_y(15 downto 8),
842
                                inhibit => '0',
843
                                even => u97_pin9,
844
                                odd => open
845
                        );
846
 
847
-- address bus register
848
        u9596: Am2920 port map (
849
                                clk => CLK,
850
            nE => ocl(2),
851
            nCLR => '1',
852
            nOE => pl(27),
853
            d => am2901_y(7 downto 0),
854
            y => ABUS(7 downto 0)
855
                        );
856
 
857
        u10506: Am2920 port map (
858
                                clk => CLK,
859
            nE => ocl(2),
860
            nCLR => '1',
861
            nOE => pl(27),
862
            d => am2901_y(15 downto 8),
863
            y => ABUS(15 downto 8)
864
                        );
865
 
866
-- data bus register (LSB)
867
        u9394: Am2920 port map (
868
                                clk => CLK,
869
            nE => ocl(1),
870
            nCLR => '1',
871
            nOE => db(1),
872
            d => am2901_y(7 downto 0),
873
            y => DBUS(7 downto 0)
874
                        );
875
 
876
-- data bus register (MSB)
877
        u10304: Am2920 port map (
878
                                clk => CLK,
879
            nE => ocl(1),
880
            nCLR => '1',
881
            nOE => db(2),
882
            d => am2901_y(15 downto 8),
883
            y => DBUS(7 downto 0)
884
                        );
885
 
886
-- data bus register (FLAGS)
887
-- 7 6 5 4  3 2 1 0 --------
888
-- S Z 0 AC 0 P 1 C --------
889
          u102: Am2918 port map (
890
                                        clk => CLK,
891
                                        nOE => db(3),
892
                                        d(3) => '1',
893
                                        d(2) => '0',
894
                                        d(1) => '0',
895
                                        d(0) => u92_pin7,
896
                                        o(3) => open,
897
                                        o(2) => open,
898
                                        o(1) => open,
899
                                        o(0) => flag_cy,
900
                                        y(3) => DBUS(1),
901
                                        y(2) => DBUS(3),
902
                                        y(1) => DBUS(5),
903
                                        y(0) => DBUS(0)
904
                                );
905
 
906
          u101: Am2918 port map (
907
                                        clk => CLK,
908
                                        nOE => db(3),
909
                                        d(3) => u91_pin4,
910
                                        d(2) => u91_pin7,
911
                                        d(1) => u91_pin9,
912
                                        d(0) => u91_pin12,
913
                                        o(3) => flag_z,
914
                                        o(2) => flag_p,
915
                                        o(1) => flag_s,
916
                                        o(0) => flag_ac,
917
                                        y(3) => DBUS(6),
918
                                        y(2) => DBUS(2),
919
                                        y(1) => DBUS(7),
920
                                        y(0) => DBUS(4)
921
                                );
922
 
923
-- bus register enabler
924
        u131: Am25139 port map (
925
                                nG1 => '0',
926
                                B1 => pl_databusenable(1),
927
                                A1 => pl_databusenable(0),
928
                                nY1(0) => open,
929
                                nY1(1) => db(1),
930
                                nY1(2) => db(2),
931
                                nY1(3) => db(3),
932
                                ---------
933
                                nG2 => '0',
934
                                B2 => pl_outputsteer(1),
935
                                A2 => pl_outputsteer(0),
936
                                nY2(0) => open,
937
                                nY2(1) => ocl(1),
938
                                nY2(2) => u131_pin10,
939
                                nY2(3) => ocl(3)
940
                        );
941
 
942
        -- high only if there is memory or io read/write                
943
        u73_pin6 <= '1' when pl_syscontrol(4 downto 1) = "1111" else '0';
944
        ocl(2) <= u131_pin10 or (t(9) nor u73_pin6);
945
 
946
-- condition code and misc bus logic
947
   u121: Am25LS374 port map (
948
                          clk => CLK,
949
           nOE => '0',
950
           d(0) => INT,
951
           d(1) => READY,
952
           d(2) => HOLD,
953
           d(3) => '0', --open
954
           d(4) => am2901_c15,
955
           d(5) => am2901_f_is_0,
956
           d(6) => am2901_f15,
957
           d(7) => '0', --open
958
           y(0) => t(8),--u121_pin2,
959
           y(1) => t(9), --u121_pin5,
960
           y(2) => t(10), --u121_pin6,
961
           y(3) => open,
962
           y(4) => t(14), --u121_pin12,
963
           y(5) => t(13), --u121_pin15,
964
           y(6) => t(12), --u121_pin16,
965
           y(7) => open
966
                        );
967
 
968
        u111: Am2920 port map (
969
                                clk => CLK,
970
            nE => ocl(3),
971
            nCLR => '1',
972
            nOE => pl_syscontrol(0), -- HLDA
973
            d(0) => am2901_f15,
974
                                d(1) => '0', --open
975
                                d(2) => '0', --open
976
                                d(3) => '0', --open
977
                                d(4) => '0', --open
978
                                d(5) => '0', --open
979
                                d(6) => '0', --open
980
                                d(7) => '0', --open
981
            y(0) => interrupt_enabled,
982
                                y(1) => open,
983
                                y(2) => open,
984
                                y(3) => open,
985
                                y(4) => open,
986
                                y(5) => open,
987
                                y(6) => open,
988
                                y(7) => open
989
                        );
990
 
991
          u113_pin1 <= pl(5) nor (pl(4) and pl(3)); -- ADD, SUBS, SUBS
992
          u83_pin8 <= am2901_c11 and u113_pin1;
993
          u83_pin3 <= am2901_c15 and u113_pin1;
994
          u126_pin6 <= u113_pin1 and (pl(4) or pl(3));
995
          u135_pin12 <= '1' when pl_alu_function = "101" else '0'; -- NOTRS
996
          u112_pin6 <= not u83_pin3;
997
 
998
          u92: Am25LS153 port map (
999
                                sel(1) => pl_updateorkeepflags(1),
1000
                                sel(0) => u126_pin6,
1001
            n1G => '0',
1002
            n2G => '0',
1003
            in1(3) => u125_pin4,
1004
                                in1(2) => u125_pin4,
1005
                                in1(1) => u112_pin6,
1006
                                in1(0) => u83_pin3,
1007
            in2 => "0000", --open
1008
            out1 => u92_pin7,
1009
            out2 => open
1010
                        );
1011
 
1012
                u125: Am25LS157 port map (
1013
                                        a(3 downto 1) => "000", -- open
1014
                                        a(0) => flag_cy,
1015
                                        b(3 downto 1) => "000", -- open
1016
                                        b(0) => bl(0),
1017
                                        s => u135_pin12,
1018
                                        nG => '0',
1019
                                        ----------------
1020
                                        y(3) => open,
1021
                                        y(2) => open,
1022
                                        y(1) => open,
1023
                                        y(0) => u125_pin4
1024
                                );
1025
 
1026
                u91: Am25LS157 port map (
1027
                                        a(3) => u83_pin8,
1028
                                        a(2) => am2901_f15,
1029
                                        a(1) => u97_pin9,
1030
                                        a(0) => am2901_f_is_0,
1031
                                        b(3) => u115_pin12,
1032
                                        b(2) => u115_pin9,
1033
                                        b(1) => u115_pin7,
1034
                                        b(0) => u115_pin4,
1035
                                        s => pl_updateorkeepflags(0),
1036
                                        nG => '0',
1037
                                        ----------------
1038
                                        y(3) => u91_pin12,
1039
                                        y(2) => u91_pin9,
1040
                                        y(1) => u91_pin7,
1041
                                        y(0) => u91_pin4
1042
                                );
1043
 
1044
                u115: Am25LS157 port map (
1045
                                        a(3) => flag_ac,
1046
                                        a(2) => flag_s,
1047
                                        a(1) => flag_p,
1048
                                        a(0) => flag_z,
1049
                                        b(3) => bl(4),
1050
                                        b(2) => bl(7),
1051
                                        b(1) => bl(2),
1052
                                        b(0) => bl(6),
1053
                                        s => u135_pin12,
1054
                                        nG => '0',
1055
                                        y(3) => u115_pin12,
1056
                                        y(2) => u115_pin9,
1057
                                        y(1) => u115_pin7,
1058
                                        y(0) => u115_pin4
1059
                                );
1060
 
1061
 
1062
end structural;
1063
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.