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

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [control/] [test_decode.sv] - Diff between revs 3 and 8

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 3 Rev 8
//==============================================================
//==============================================================
// Test PLA decode and combinatorial static execute
// Test PLA decode and combinatorial static execute
//==============================================================
//==============================================================
`timescale 100 ns/ 100 ns
`timescale 100 ns/ 100 ns
module test_decode;
module test_decode;
reg [7:0] ir_sig;
reg [7:0] ir_sig;
reg [4:0] prefix_sig;
reg [4:0] prefix_sig;
wire [107:0] pla_sig;
wire [107:0] pla_sig;
// ----------------- TEST -------------------
// ----------------- TEST -------------------
initial begin
initial begin
    integer opcode;
    integer opcode;
    // Test every opcode in the first table
    // Test every opcode in the first table
    //================================================
    //================================================
    // Regular instructions with no prefix
    // Regular instructions with no prefix
    //================================================
    //================================================
    $display("START IXY0:XX");
    $display("START IXY0:XX");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b10100;
           prefix_sig[4:0] = 5'b10100;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
    //================================================
    //================================================
    // Regular instructions with IX/IY prefix
    // Regular instructions with IX/IY prefix
    //================================================
    //================================================
    $display("START IXY1:XX");
    $display("START IXY1:XX");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
    //================================================
    //================================================
    // CD instructions with no prefix
    // CD instructions with no prefix
    //================================================
    //================================================
    $display("START IXY0:CB");
    $display("START IXY0:CB");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b10010;
           prefix_sig[4:0] = 5'b10010;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
    //================================================
    //================================================
    // CB instructions with IX/IY prefix
    // CB instructions with IX/IY prefix
    //================================================
    //================================================
    $display("START IXY1:CB");
    $display("START IXY1:CB");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b01010;
           prefix_sig[4:0] = 5'b01010;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
    //================================================
    //================================================
    // ED instructions with no prefix
    // ED instructions with no prefix
    //================================================
    //================================================
    $display("START IXY0:ED");
    $display("START IXY0:ED");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b10001;
           prefix_sig[4:0] = 5'b10001;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01100;
           prefix_sig[4:0] = 5'b01100;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
    //================================================
    //================================================
    // ED instructions with IX/IY prefix
    // ED instructions with IX/IY prefix
    //================================================
    //================================================
    $display("START IXY1:ED");
    $display("START IXY1:ED");
    opcode = 0;
    opcode = 0;
    while(opcode<256) begin
    while(opcode<256) begin
        #1 $display("OPCODE: 0x%2H", opcode);
        #1 $display("OPCODE: 0x%2H", opcode);
           prefix_sig[4:0] = 5'b01001;
           prefix_sig[4:0] = 5'b01001;
           ir_sig[7:0] = opcode;
           ir_sig[7:0] = opcode;
        #1 // Reset the IR into NOP so we get the trigger signal again
        #1 // Reset the IR into NOP so we get the trigger signal again
           prefix_sig[4:0] = 5'b01001;
           prefix_sig[4:0] = 5'b01001;
           ir_sig[7:0] = 0;
           ir_sig[7:0] = 0;
           opcode++;
           opcode++;
    end
    end
    #1 $display("END");
    #1 $display("END");
end
end
//--------------------------------------------------------------
//--------------------------------------------------------------
// Instantiate decode blocks
// Instantiate decode blocks
//--------------------------------------------------------------
//--------------------------------------------------------------
pla_decode pla_decode_inst
pla_decode pla_decode_inst
(
(
    .prefix(prefix_sig) ,       // input [6:0] prefix_sig
    .prefix(prefix_sig) ,       // input [6:0] prefix_sig
    .opcode(ir_sig) ,           // input [7:0] opcode
    .opcode(ir_sig) ,           // input [7:0] opcode
    .pla(pla_sig)               // output [104:0] pla_sig
    .pla(pla_sig)               // output [104:0] pla_sig
);
);
execute execute_inst
execute execute_inst
(
(
    .pla(pla_sig) ,             // input [107:0] pla_sig
    .pla(pla_sig) ,             // input [107:0] pla_sig
    .M1(M1_sig) ,               // input  M1_sig
    .M1(M1_sig) ,               // input  M1_sig
    .M2(M2_sig) ,               // input  M2_sig
    .M2(M2_sig) ,               // input  M2_sig
    .M3(M3_sig) ,               // input  M3_sig
    .M3(M3_sig) ,               // input  M3_sig
    .M4(M4_sig) ,               // input  M4_sig
    .M4(M4_sig) ,               // input  M4_sig
    .M5(M5_sig) ,               // input  M5_sig
    .M5(M5_sig) ,               // input  M5_sig
    .M6(M6_sig) ,               // input  M6_sig
 
    .T1(T1_sig) ,               // input  T1_sig
    .T1(T1_sig) ,               // input  T1_sig
    .T2(T2_sig) ,               // input  T2_sig
    .T2(T2_sig) ,               // input  T2_sig
    .T3(T3_sig) ,               // input  T3_sig
    .T3(T3_sig) ,               // input  T3_sig
    .T4(T4_sig) ,               // input  T4_sig
    .T4(T4_sig) ,               // input  T4_sig
    .T5(T5_sig) ,               // input  T5_sig
    .T5(T5_sig) ,               // input  T5_sig
    .T6(T6_sig) ,               // input  T6_sig
    .T6(T6_sig) ,               // input  T6_sig
    .nextM(nextM_sig) ,         // output  nextM_sig
    .nextM(nextM_sig) ,         // output  nextM_sig
    .setM1(setM1_sig) ,         // output  setM1_sig
    .setM1(setM1_sig) ,         // output  setM1_sig
    .setM1ss(setM1ss_sig) ,     // output  setM1ss_sig
    .setM1ss(setM1ss_sig) ,     // output  setM1ss_sig
    .setM1cc(setM1cc_sig) ,     // output  setM1cc_sig
    .setM1cc(setM1cc_sig) ,     // output  setM1cc_sig
    .setM1bz(setM1bz_sig) ,     // output  setM1bz_sig
    .setM1bz(setM1bz_sig) ,     // output  setM1bz_sig
    .fFetch(fFetch_sig) ,       // output  fFetch_sig
    .fFetch(fFetch_sig) ,       // output  fFetch_sig
    .fMRead(fMRead_sig) ,       // output  fMRead_sig
    .fMRead(fMRead_sig) ,       // output  fMRead_sig
    .fMWrite(fMWrite_sig) ,     // output  fMWrite_sig
    .fMWrite(fMWrite_sig) ,     // output  fMWrite_sig
    .fIORead(fIORead_sig) ,     // output  fIORead_sig
    .fIORead(fIORead_sig) ,     // output  fIORead_sig
    .fIOWrite(fIOWrite_sig) ,   // output  fIOWrite_sig
    .fIOWrite(fIOWrite_sig) ,   // output  fIOWrite_sig
    .FIntr(FIntr_sig) ,         // output  FIntr_sig
    .FIntr(FIntr_sig) ,         // output  FIntr_sig
    .ctl_bus_sw1(ctl_bus_sw1_sig) ,         // output  ctl_bus_sw1_sig
    .ctl_bus_sw1(ctl_bus_sw1_sig) ,         // output  ctl_bus_sw1_sig
    .ctl_bus_sw2(ctl_bus_sw2_sig) ,         // output  ctl_bus_sw2_sig
    .ctl_bus_sw2(ctl_bus_sw2_sig) ,         // output  ctl_bus_sw2_sig
    .ctl_bus_sw4(ctl_bus_sw4_sig) ,         // output  ctl_bus_sw4_sig
    .ctl_bus_sw4(ctl_bus_sw4_sig) ,         // output  ctl_bus_sw4_sig
    .ctl_al_we(ctl_al_we_sig) ,             // output  ctl_al_we_sig
    .ctl_al_we(ctl_al_we_sig) ,             // output  ctl_al_we_sig
    .ctl_inc_dec(ctl_inc_dec_sig) ,         // output  ctl_inc_dec_sig
    .ctl_inc_dec(ctl_inc_dec_sig) ,         // output  ctl_inc_dec_sig
    .ctl_inc_limit6(ctl_inc_limit6_sig) ,   // output  ctl_inc_limit6_sig
    .ctl_inc_limit6(ctl_inc_limit6_sig) ,   // output  ctl_inc_limit6_sig
    .ctl_inc_cy(ctl_inc_cy_sig) ,           // output  ctl_inc_cy_sig
    .ctl_inc_cy(ctl_inc_cy_sig) ,           // output  ctl_inc_cy_sig
    .ctl_ab_mux_inc(ctl_ab_mux_inc_sig) ,   // output  ctl_ab_mux_inc_sig
    .ctl_ab_mux_inc(ctl_ab_mux_inc_sig) ,   // output  ctl_ab_mux_inc_sig
    .explode(explode_sig)                   // output  explode_sig
    .explode(explode_sig)                   // output  explode_sig
);
);
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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