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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [id.v] - Diff between revs 203 and 205

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

Rev 203 Rev 205
Line 58... Line 58...
module id(
module id(
        // Clock and reset
        // Clock and reset
        clk, rst,
        clk, rst,
 
 
        // Internal i/f
        // Internal i/f
        pipeline_freeze, except_flushpipe, if_insn, branch_op,
        id_freeze, ex_freeze, wb_freeze, except_flushpipe, if_insn, branch_op,
        rf_addra, rf_addrb, alu_op, shrot_op, comp_op, rf_addrw, rfwb_op,
        rf_addra, rf_addrb, alu_op, shrot_op, comp_op, rf_addrw, rfwb_op,
        wb_insn, simm, branch_addrofs, lsu_addrofs, sel_a, sel_b, lsu_op,
        wb_insn, simm, branch_addrofs, lsu_addrofs, sel_a, sel_b, lsu_op,
        multicycle, spr_addrimm, wbforw_valid, sig_syscall,
        multicycle, spr_addrimm, wbforw_valid, sig_syscall,
        force_dslot_fetch
        force_dslot_fetch
);
);
Line 70... Line 70...
//
//
// I/O
// I/O
//
//
input                                   clk;
input                                   clk;
input                                   rst;
input                                   rst;
input                                   pipeline_freeze;
input                                   id_freeze;
 
input                                   ex_freeze;
 
input                                   wb_freeze;
input                                   except_flushpipe;
input                                   except_flushpipe;
input   [31:0]                           if_insn;
input   [31:0]                           if_insn;
output  [`BRANCHOP_WIDTH-1:0]            branch_op;
output  [`BRANCHOP_WIDTH-1:0]            branch_op;
output  [`REGFILE_ADDR_WIDTH-1:0]        rf_addrw;
output  [`REGFILE_ADDR_WIDTH-1:0]        rf_addrw;
output  [`REGFILE_ADDR_WIDTH-1:0]        rf_addra;
output  [`REGFILE_ADDR_WIDTH-1:0]        rf_addra;
Line 176... Line 178...
// Decode of spr_addrimm
// Decode of spr_addrimm
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                spr_addrimm <= #1 16'h0000;
                spr_addrimm <= #1 16'h0000;
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                spr_addrimm <= #1 16'h0000;
 
        else if (!ex_freeze) begin
                case (id_insn[31:26])   // synopsys full_case parallel_case
                case (id_insn[31:26])   // synopsys full_case parallel_case
                        // l.mtspr
                        // l.mtspr
                        `OR32_MTSPR:
                        `OR32_MTSPR:
                                spr_addrimm <= #1 id_insn[15:0];
                                spr_addrimm <= #1 id_insn[15:0];
                        // l.mfspr
                        // l.mfspr
Line 297... Line 301...
// Register file write address
// Register file write address
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                rf_addrw <= #1 5'd0;
                rf_addrw <= #1 5'd0;
        else if (!pipeline_freeze)
        else if (!ex_freeze & id_freeze)
 
                rf_addrw <= #1 5'd00;
 
        else if (!ex_freeze)
                case (pre_branch_op)    // synopsys parallel_case full_case
                case (pre_branch_op)    // synopsys parallel_case full_case
                        `BRANCHOP_JR, `BRANCHOP_BAL:
                        `BRANCHOP_JR, `BRANCHOP_BAL:
                                rf_addrw <= #1 5'd09;   // link register r9
                                rf_addrw <= #1 5'd09;   // link register r9
                        default:
                        default:
                                rf_addrw <= #1 id_insn[25:21];
                                rf_addrw <= #1 id_insn[25:21];
Line 312... Line 318...
// rf_addrw in wb stage (used in forwarding logic)
// rf_addrw in wb stage (used in forwarding logic)
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                wb_rfaddrw <= #1 5'd0;
                wb_rfaddrw <= #1 5'd0;
        else if (!pipeline_freeze)
        else if (!wb_freeze)
                wb_rfaddrw <= #1 rf_addrw;
                wb_rfaddrw <= #1 rf_addrw;
end
end
 
 
//
//
// Instruction latch in id_insn
// Instruction latch in id_insn
Line 324... Line 330...
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst) begin
        if (rst) begin
                id_insn[31:26] <= #1 `OR32_NOP;
                id_insn[31:26] <= #1 `OR32_NOP;
                id_insn[25:0] <= #1 26'd0;
                id_insn[25:0] <= #1 26'd0;
        end
        end
        else if (!pipeline_freeze) begin
        else if (!id_freeze) begin
                id_insn <= #1 if_insn;
                id_insn <= #1 if_insn;
`ifdef OR1200_VERBOSE
`ifdef OR1200_VERBOSE
// synopsys translate_off
// synopsys translate_off
                $display("%t: id_insn <= %h", $time, if_insn);
                $display("%t: id_insn <= %h", $time, if_insn);
// synopsys translate_on
// synopsys translate_on
Line 342... Line 348...
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst) begin
        if (rst) begin
                ex_insn[31:26] <= #1 `OR32_NOP;
                ex_insn[31:26] <= #1 `OR32_NOP;
                ex_insn[25:0] <= #1 26'd0;
                ex_insn[25:0] <= #1 26'd0;
        end
        end
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                ex_insn <= #1 {`OR32_NOP, 26'h000_4444};
 
        else if (!ex_freeze) begin
                ex_insn <= #1 id_insn;
                ex_insn <= #1 id_insn;
`ifdef OR1200_VERBOSE
`ifdef OR1200_VERBOSE
// synopsys translate_off
// synopsys translate_off
                $display("%t: ex_insn <= %h", $time, id_insn);
                $display("%t: ex_insn <= %h", $time, id_insn);
// synopsys translate_on
// synopsys translate_on
Line 360... Line 368...
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst) begin
        if (rst) begin
                wb_insn[31:26] <= #1 `OR32_NOP;
                wb_insn[31:26] <= #1 `OR32_NOP;
                wb_insn[25:0] <= #1 26'd0;
                wb_insn[25:0] <= #1 26'd0;
        end
        end
        else if (!pipeline_freeze) begin
        else if (!wb_freeze) begin
                wb_insn <= #1 ex_insn;
                wb_insn <= #1 ex_insn;
        end
        end
end
end
 
 
//
//
// Decode of sel_imm
// Decode of sel_imm
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                sel_imm <= #1 1'b0;
                sel_imm <= #1 1'b0;
        else if (!pipeline_freeze) begin
        else if (!id_freeze) begin
          case (if_insn[31:26])         // synopsys full_case parallel_case
          case (if_insn[31:26])         // synopsys full_case parallel_case
 
 
            // j.jalr
            // j.jalr
            `OR32_JALR:
            `OR32_JALR:
              sel_imm <= #1 `off;
              sel_imm <= #1 `off;
Line 439... Line 447...
// Decode of alu_op
// Decode of alu_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                alu_op <= #1 `ALUOP_NOP;
                alu_op <= #1 `ALUOP_NOP;
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                alu_op <= #1 `ALUOP_NOP;
 
        else if (!ex_freeze) begin
          case (id_insn[31:26])         // synopsys full_case parallel_case
          case (id_insn[31:26])         // synopsys full_case parallel_case
 
 
            // l.j
            // l.j
            `OR32_J:
            `OR32_J:
              alu_op <= #1 `ALUOP_IMM;
              alu_op <= #1 `ALUOP_IMM;
Line 587... Line 597...
// Decode of shrot_op
// Decode of shrot_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                shrot_op <= #1 `SHROTOP_NOP;
                shrot_op <= #1 `SHROTOP_NOP;
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                shrot_op <= #1 `SHROTOP_NOP;
 
        else if (!ex_freeze) begin
                shrot_op <= #1 id_insn[`SHROTOP_POS];
                shrot_op <= #1 id_insn[`SHROTOP_POS];
        end
        end
end
end
 
 
//
//
// Decode of rfwb_op
// Decode of rfwb_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                rfwb_op <= #1 `RFWBOP_NOP;
                rfwb_op <= #1 `RFWBOP_NOP;
        else  if (!pipeline_freeze) begin
        else  if (!ex_freeze & id_freeze)
 
                rfwb_op <= #1 `RFWBOP_NOP;
 
        else  if (!ex_freeze) begin
                case (id_insn[31:26])           // synopsys full_case parallel_case
                case (id_insn[31:26])           // synopsys full_case parallel_case
 
 
                  // j.jal
                  // j.jal
                  `OR32_JAL:
                  `OR32_JAL:
                    rfwb_op <= #1 `RFWBOP_LR;
                    rfwb_op <= #1 `RFWBOP_LR;
Line 688... Line 702...
// Decode of pre_branch_op
// Decode of pre_branch_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                pre_branch_op <= #1 `BRANCHOP_NOP;
                pre_branch_op <= #1 `BRANCHOP_NOP;
        else if (!pipeline_freeze) begin
        else if (!id_freeze) begin
                case (if_insn[31:26])           // synopsys full_case parallel_case
                case (if_insn[31:26])           // synopsys full_case parallel_case
 
 
                  // l.j
                  // l.j
                  `OR32_J:
                  `OR32_J:
                    pre_branch_op <= #1 `BRANCHOP_BAL;
                    pre_branch_op <= #1 `BRANCHOP_BAL;
Line 733... Line 747...
// Generation of branch_op
// Generation of branch_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                branch_op <= #1 `BRANCHOP_NOP;
                branch_op <= #1 `BRANCHOP_NOP;
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                branch_op <= #1 `BRANCHOP_NOP;
 
        else if (!ex_freeze) begin
                branch_op <= #1 pre_branch_op;
                branch_op <= #1 pre_branch_op;
        end
        end
end
end
 
 
//
//
// Decode of lsu_op
// Decode of lsu_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                lsu_op <= #1 `LSUOP_NOP;
                lsu_op <= #1 `LSUOP_NOP;
        else if (!pipeline_freeze)  begin
        else if (!ex_freeze & id_freeze)
 
                lsu_op <= #1 `LSUOP_NOP;
 
        else if (!ex_freeze)  begin
          case (id_insn[31:26])         // synopsys full_case parallel_case
          case (id_insn[31:26])         // synopsys full_case parallel_case
 
 
            // l.lwz
            // l.lwz
            `OR32_LWZ:
            `OR32_LWZ:
              lsu_op <= #1 `LSUOP_LWZ;
              lsu_op <= #1 `LSUOP_LWZ;
Line 793... Line 811...
// Decode of comp_op
// Decode of comp_op
//
//
always @(posedge clk or posedge rst_or_except_flushpipe) begin
always @(posedge clk or posedge rst_or_except_flushpipe) begin
        if (rst_or_except_flushpipe)
        if (rst_or_except_flushpipe)
                comp_op <= #1 4'd0;
                comp_op <= #1 4'd0;
        else if (!pipeline_freeze) begin
        else if (!ex_freeze & id_freeze)
 
                comp_op <= #1 4'd0;
 
        else if (!ex_freeze) begin
                comp_op <= #1 id_insn[24:21];
                comp_op <= #1 id_insn[24:21];
        end
        end
end
end
 
 
//
//
// Decode of l.sys
// Decode of l.sys
//
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst)
        if (rst)
                sig_syscall <= #1 1'b0;
                sig_syscall <= #1 1'b0;
        else if (!pipeline_freeze) begin
        else if (!wb_freeze) begin
`ifdef OR1200_VERBOSE
`ifdef OR1200_VERBOSE
// synopsys translate_off
// synopsys translate_off
                if (wb_insn[31:24] == {`OR32_XSYNC, 2'b00})
                if (wb_insn[31:24] == {`OR32_XSYNC, 2'b00})
                        $display("Generating sig_syscall");
                        $display("Generating sig_syscall");
// synopsys translate_on
// synopsys translate_on

powered by: WebSVN 2.1.0

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