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

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [toplevel/] [core.vh] - Diff between revs 6 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 8
Line 6... Line 6...
//============================================================================
//============================================================================
 
 
// Include a list of top-level signal wires
// Include a list of top-level signal wires
`include "globals.vh"
`include "globals.vh"
 
 
// Specific to Modelsim, some modules in the schematics need to be pre-initialized
// Specific to simulation, some modules in the schematics need to be pre-initialized
// to avoid starting simulations with unknown values in selected flip flops.
// to avoid starting simulations with unknown values in selected flip flops.
// When synthesized, the CPU RESET input signal will do the work.
reg fpga_reset = 1;
reg fpga_reset = 0;
always @(posedge clk)
initial begin
begin
    fpga_reset = 1;
    fpga_reset <= 0;
    #1 fpga_reset = 0;
 
end
end
 
 
// Define internal data bus partitions separated by data bus switches
// Define internal data bus partitions segmented by data bus switches
wire [7:0] db0;         // Segment connecting data pins and IR
wire [7:0] db0;         // Segment connecting data pins and IR
wire [7:0] db1;         // Segment with ALU
wire [7:0] db1;         // Segment leading to the ALU
wire [7:0] db2;         // Segment with msb part of the register address-side interface
wire [7:0] db2;         // Segment with msb part of the register address-side interface
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wire [7:0] db_hi_as;    // Register file data bus segment high byte
// Control block
wire [7:0] db_lo_as;    // Register file data bus segment low byte
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// Collect the PLA instruction decode prefix bitfield
wire [6:0] prefix;      // Instruction decode PLA prefix bitfield
logic [6:0] prefix;
 
assign prefix = { ~use_ixiy, use_ixiy, ~in_halt, in_alu, table_xx, table_cb, table_ed };
assign prefix = { ~use_ixiy, use_ixiy, ~in_halt, in_alu, table_xx, table_cb, table_ed };
 
 
ir          instruction_reg_( .*, .db(db0[7:0]) );
wire nM1_int;           // External pins timing control
pla_decode  pla_decode_( .* );
assign nM1_int = !(setM1 | (fFetch & T1));
resets      reset_block_( .* );
 
sequencer   sequencer_( .* );
`include "coremodules.vh"
execute     execute_( .* );
 
interrupts  interrupts_( .*, .db(db0[4:3]) );
 
decode_state decode_state_( .* );
 
clk_delay   clk_delay_( .* );
 
pin_control pin_control_( .* );
 
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// ALU and ALU control, including the flags
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
alu_control alu_control_( .*, .db(db1[7:0]), .op543({pla[104],pla[103],pla[102]}) );
 
alu_select  alu_select_( .* );
 
alu_flags   alu_flags_( .*, .db(db1[7:0]) );
 
alu         alu_( .*, .db(db2[7:0]), .bsel(db0[5:3]) );
 
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// Register file and register control
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
wire [7:0] db_hi_as;
 
wire [7:0] db_lo_as;
 
 
 
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]) );
 
reg_control reg_control_( .* );
 
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// Address latch (with the incrementer)
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
address_latch address_latch_( .*, .abus({db_hi_as[7:0], db_lo_as[7:0]}) );
 
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// Timing control of the external pins
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
wire nM1_int;
 
assign nM1_int = !((setM1 & nextM) | (fFetch & T1));
 
memory_ifc memory_ifc_( .* );
 
 
 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
// Data path within the CPU in various forms, ending with data pins
// Data path within the CPU in various forms, ending with data pins
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
bus_switch bus_switch_( .* );
 
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]) );
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]) );
 
 
// Controls writers to the first section of the data bus
 
bus_control bus_control_( .*, .db(db0[7:0]) );
 
 
 
// Data switch SW1 with the data mask
// Data switch SW1 with the data mask
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]) );
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]) );
 
 
 No newline at end of file
 No newline at end of file
 
/* This SystemVerilog-style code is kept for future reference
 
// Control block
 
clk_delay   clk_delay_( .* );
 
decode_state decode_state_( .* );
 
execute     execute_( .* );
 
interrupts  interrupts_( .*, .db(db0[4:3]) );
 
ir          ir_( .*, .db(db0[7:0]) );
 
pin_control pin_control_( .* );
 
pla_decode  pla_decode_( .* );
 
resets      resets_( .* );
 
sequencer   sequencer_( .* );
 
 
 
// ALU and ALU control, including the flags
 
alu_control alu_control_( .*, .db(db1[7:0]), .op543({pla[104],pla[103],pla[102]}) );
 
alu_select  alu_select_( .* );
 
alu_flags   alu_flags_( .*, .db(db1[7:0]) );
 
alu         alu_( .*, .db(db2[7:0]), .bsel(db0[5:3]) );
 
 
 
// Register file and register control
 
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]) );
 
reg_control reg_control_( .* );
 
 
 
// Address latch and the incrementer
 
address_latch address_latch_( .*, .abus({db_hi_as[7:0], db_lo_as[7:0]}) );
 
 
 
// Misc bus
 
bus_control bus_control_( .*, .db(db0[7:0]) );
 
bus_switch bus_switch_( .* );
 
 
 
// Timing control of the external pins
 
memory_ifc memory_ifc_( .* );
 
*/
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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