OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [toplevel/] [core.vh] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 gdevic
//============================================================================
2
// A-Z80 core, instantiates and connects all internal blocks.
3
//
4
// This file is included by the "z80_top_ifc_n" and "z80_top_direct" providing
5
// interface binding and direct (no interface) binding.
6
//============================================================================
7
 
8
// Include a list of top-level signal wires
9
`include "globals.vh"
10
 
11
// Specific to Modelsim, some modules in the schematics need to be pre-initialized
12
// to avoid starting simulations with unknown values in selected flip flops.
13
// When synthesized, the CPU RESET input signal will do the work.
14
reg fpga_reset = 0;
15
initial begin
16
    fpga_reset = 1;
17
    #1 fpga_reset = 0;
18
end
19
 
20
// Define internal data bus partitions separated by data bus switches
21
wire [7:0] db0;         // Segment connecting data pins and IR
22
wire [7:0] db1;         // Segment with ALU
23
wire [7:0] db2;         // Segment with msb part of the register address-side interface
24
 
25
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
// Control block
27
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28
// Collect the PLA instruction decode prefix bitfield
29
logic [6:0] prefix;
30
assign prefix = { ~use_ixiy, use_ixiy, ~in_halt, in_alu, table_xx, table_cb, table_ed };
31
 
32
ir          instruction_reg_( .*, .db(db0[7:0]) );
33
pla_decode  pla_decode_( .* );
34
resets      reset_block_( .* );
35
sequencer   sequencer_( .* );
36
execute     execute_( .* );
37
interrupts  interrupts_( .*, .db(db0[4:3]) );
38
decode_state decode_state_( .* );
39
clk_delay   clk_delay_( .* );
40
pin_control pin_control_( .* );
41
 
42
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
// ALU and ALU control, including the flags
44
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
alu_control alu_control_( .*, .db(db1[7:0]), .op543({pla[104],pla[103],pla[102]}) );
46
alu_select  alu_select_( .* );
47
alu_flags   alu_flags_( .*, .db(db1[7:0]) );
48
alu         alu_( .*, .db(db2[7:0]), .bsel(db0[5:3]) );
49
 
50
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51
// Register file and register control
52
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
wire [7:0] db_hi_as;
54
wire [7:0] db_lo_as;
55
 
56
reg_file    reg_file_( .*, .db_hi_ds(db2[7:0]), .db_lo_ds(db1[7:0]), .db_hi_as(db_hi_as[7:0]), .db_lo_as(db_lo_as[7:0]) );
57
reg_control reg_control_( .* );
58
 
59
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
// Address latch (with the incrementer)
61
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62
address_latch address_latch_( .*, .abus({db_hi_as[7:0], db_lo_as[7:0]}) );
63
 
64
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
// Timing control of the external pins
66
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
wire nM1_int;
68
assign nM1_int = !((setM1 & nextM) | (fFetch & T1));
69
memory_ifc memory_ifc_( .* );
70
 
71
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
// Data path within the CPU in various forms, ending with data pins
73
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
bus_switch bus_switch_( .* );
75
data_switch sw2_( .sw_up_en(bus_sw_2u), .sw_down_en(bus_sw_2d), .db_up(db1[7:0]), .db_down(db2[7:0]) );
76
 
77
// Controls writers to the first section of the data bus
78
bus_control bus_control_( .*, .db(db0[7:0]) );
79
 
80
// Data switch SW1 with the data mask
81
data_switch_mask sw1_( .sw_mask543_en(bus_sw_mask543_en), .sw_up_en(bus_sw_1u), .sw_down_en(bus_sw_1d), .db_up(db0[7:0]), .db_down(db1[7:0]) );

powered by: WebSVN 2.1.0

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