OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [rtl/] [zipsystem.v] - Diff between revs 11 and 18

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

Rev 11 Rev 18
Line 127... Line 127...
                // Wishbone master interface from the CPU
                // Wishbone master interface from the CPU
                o_wb_cyc, o_wb_stb, o_wb_we, o_wb_addr, o_wb_data,
                o_wb_cyc, o_wb_stb, o_wb_we, o_wb_addr, o_wb_data,
                        i_wb_ack, i_wb_stall, i_wb_data,
                        i_wb_ack, i_wb_stall, i_wb_data,
                // Incoming interrupts
                // Incoming interrupts
                i_ext_int,
                i_ext_int,
 
                // Our one outgoing interrupt
 
                o_ext_int,
                // Wishbone slave interface for debugging purposes
                // Wishbone slave interface for debugging purposes
                i_dbg_cyc, i_dbg_stb, i_dbg_we, i_dbg_addr, i_dbg_data,
                i_dbg_cyc, i_dbg_stb, i_dbg_we, i_dbg_addr, i_dbg_data,
                        o_dbg_ack, o_dbg_stall, o_dbg_data);
                        o_dbg_ack, o_dbg_stall, o_dbg_data);
        parameter       RESET_ADDRESS=32'h0100000;
        parameter       RESET_ADDRESS=32'h0100000;
        input   i_clk, i_rst;
        input   i_clk, i_rst;
Line 140... Line 142...
        output  wire    [31:0]   o_wb_data;
        output  wire    [31:0]   o_wb_data;
        input                   i_wb_ack, i_wb_stall;
        input                   i_wb_ack, i_wb_stall;
        input           [31:0]   i_wb_data;
        input           [31:0]   i_wb_data;
        // Incoming interrupts
        // Incoming interrupts
        input                   i_ext_int;
        input                   i_ext_int;
 
        // Outgoing interrupt
 
        output  wire            o_ext_int;
        // Wishbone slave
        // Wishbone slave
        input                   i_dbg_cyc, i_dbg_stb, i_dbg_we, i_dbg_addr;
        input                   i_dbg_cyc, i_dbg_stb, i_dbg_we, i_dbg_addr;
        input           [31:0]   i_dbg_data;
        input           [31:0]   i_dbg_data;
        output  wire            o_dbg_ack;
        output  wire            o_dbg_ack;
        output  wire            o_dbg_stall;
        output  wire            o_dbg_stall;
Line 193... Line 197...
        // two accesses: write the address to the control register (and halt
        // two accesses: write the address to the control register (and halt
        // the CPU if not halted), then read/write the data from the data
        // the CPU if not halted), then read/write the data from the data
        // register.
        // register.
        //
        //
        wire            cpu_break, dbg_cmd_write;
        wire            cpu_break, dbg_cmd_write;
        reg             cmd_reset, cmd_halt, cmd_step;
        reg             cmd_reset, cmd_halt, cmd_step, cmd_clear_pf_cache;
        reg     [5:0]    cmd_addr;
        reg     [5:0]    cmd_addr;
 
        wire    [3:0]    cpu_dbg_cc;
        assign  dbg_cmd_write = (dbg_cyc)&&(dbg_stb)&&(dbg_we)&&(~dbg_addr);
        assign  dbg_cmd_write = (dbg_cyc)&&(dbg_stb)&&(dbg_we)&&(~dbg_addr);
        //
        //
        initial cmd_reset = 1'b1;
        initial cmd_reset = 1'b1;
        always @(posedge i_clk)
        always @(posedge i_clk)
                cmd_reset <= ((dbg_cmd_write)&&(dbg_idata[6]));
                cmd_reset <= ((dbg_cmd_write)&&(dbg_idata[6]));
Line 209... Line 214...
                        cmd_halt <= 1'b1;
                        cmd_halt <= 1'b1;
                else if (dbg_cmd_write)
                else if (dbg_cmd_write)
                        cmd_halt <= dbg_idata[10];
                        cmd_halt <= dbg_idata[10];
                else if ((cmd_step)||(cpu_break))
                else if ((cmd_step)||(cpu_break))
                        cmd_halt  <= 1'b1;
                        cmd_halt  <= 1'b1;
 
 
 
        always @(posedge i_clk)
 
                if (i_rst)
 
                        cmd_clear_pf_cache <= 1'b0;
 
                else if (dbg_cmd_write)
 
                        cmd_clear_pf_cache <= dbg_idata[11];
 
                else
 
                        cmd_clear_pf_cache <= 1'b0;
        //
        //
        initial cmd_step  = 1'b0;
        initial cmd_step  = 1'b0;
        always @(posedge i_clk)
        always @(posedge i_clk)
                cmd_step <= (dbg_cmd_write)&&(dbg_idata[8]);
                cmd_step <= (dbg_cmd_write)&&(dbg_idata[8]);
        //
        //
Line 225... Line 238...
 
 
        wire    cpu_halt, cpu_dbg_stall;
        wire    cpu_halt, cpu_dbg_stall;
        assign  cpu_halt = (cmd_halt)&&(~cmd_step);
        assign  cpu_halt = (cmd_halt)&&(~cmd_step);
        wire    [31:0]   pic_data;
        wire    [31:0]   pic_data;
        wire    [31:0]   cmd_data;
        wire    [31:0]   cmd_data;
        assign  cmd_data = { 21'h00, cmd_halt, (~cpu_dbg_stall), 1'b0, pic_data[15],
        // Values:
                        cpu_reset, cmd_addr };
        //      0x0003f -> cmd_addr mask
 
        //      0x00040 -> reset
 
        //      0x00080 -> interrrupts enabled
 
        //      0x00100 -> cmd_step
 
        //      0x00200 -> cmd_stall
 
        //      0x00400 -> cmd_halt
 
        //      0x00800 -> cmd_clear_pf_cache
 
        //      0x01000 -> cc.sleep
 
        //      0x02000 -> cc.gie
 
        //      0x04000 -> cc.step
 
        //      0x08000 -> cc.break_en
 
        //      0x10000 -> External interrupt line is high
 
        assign  cmd_data = { 15'h00, i_ext_int, cpu_dbg_cc,
 
                        1'b0, cmd_halt, (~cpu_dbg_stall), 1'b0,
 
                        pic_data[15], cpu_reset, cmd_addr };
 
 
`ifdef  USE_TRAP
`ifdef  USE_TRAP
        //
        //
        // The TRAP peripheral
        // The TRAP peripheral
        //
        //
Line 449... Line 476...
        wire            cpu_ack, cpu_stall;
        wire            cpu_ack, cpu_stall;
        wire    [31:0]   cpu_dbg_data;
        wire    [31:0]   cpu_dbg_data;
        assign cpu_dbg_we = ((dbg_cyc)&&(dbg_stb)&&(~cmd_addr[5])
        assign cpu_dbg_we = ((dbg_cyc)&&(dbg_stb)&&(~cmd_addr[5])
                                        &&(dbg_we)&&(dbg_addr));
                                        &&(dbg_we)&&(dbg_addr));
        zipcpu  #(RESET_ADDRESS) thecpu(i_clk, cpu_reset, pic_interrupt,
        zipcpu  #(RESET_ADDRESS) thecpu(i_clk, cpu_reset, pic_interrupt,
                        cpu_halt, cmd_addr[4:0], cpu_dbg_we,
                        cpu_halt, cmd_clear_pf_cache, cmd_addr[4:0], cpu_dbg_we,
                                dbg_idata, cpu_dbg_stall, cpu_dbg_data,
                                dbg_idata, cpu_dbg_stall, cpu_dbg_data,
                                cpu_break,
                                cpu_dbg_cc, cpu_break,
                        cpu_cyc, cpu_stb, cpu_we, cpu_addr, cpu_data,
                        cpu_cyc, cpu_stb, cpu_we, cpu_addr, cpu_data,
                                cpu_ack, cpu_stall, wb_data,
                                cpu_ack, cpu_stall, wb_data,
                        cpu_op_stall, cpu_pf_stall, cpu_i_count);
                        cpu_op_stall, cpu_pf_stall, cpu_i_count);
 
 
        // Now, arbitrate the bus ... first for the local peripherals
        // Now, arbitrate the bus ... first for the local peripherals
Line 527... Line 554...
 
 
        assign  cpu_stall = (tma_stall | tmb_stall | tmc_stall | jif_stall
        assign  cpu_stall = (tma_stall | tmb_stall | tmc_stall | jif_stall
                                | wdt_stall | cache_stall
                                | wdt_stall | cache_stall
                                | cpu_ext_stall);
                                | cpu_ext_stall);
        assign  cpu_ack = (tmr_ack|wdt_ack|cache_ack|cpu_ext_ack|ctri_ack|actr_ack|pic_ack);
        assign  cpu_ack = (tmr_ack|wdt_ack|cache_ack|cpu_ext_ack|ctri_ack|actr_ack|pic_ack);
 
 
 
        assign  o_ext_int = (cmd_halt) && (~cpu_stall);
 
 
endmodule
endmodule
 
 
 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.