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

Subversion Repositories suslik

[/] [suslik/] [trunk/] [rtl/] [cpu.v] - Diff between revs 8 and 9

Show entire file | Details | Blame | View Log

Rev 8 Rev 9
Line 1... Line 1...
 
 
module aluplus(instr, val1, val2, valres, wrtval, cjmpinstr,cjmp,const1,retaddr,wrspec);
module aluplus(instr, val1, val2, valres, wrtval, cjmpinstr,cjmp,const1,retaddr,wrspec,irq_bits);
 
 
  input [31:0] instr, val1, val2;
  input [31:0] instr, val1, val2;
  output [31:0] valres;
  output [31:0] valres;
  output wire wrtval,cjmpinstr;
  output wire wrtval,cjmpinstr;
  output cjmp;
  output cjmp;
  input [31:0] const1;
  input [31:0] const1;
  input [31:0] retaddr;
  input [31:0] retaddr;
  output wrspec;
  output wrspec;
 
  input [15:0] irq_bits;
 
 
  wire [5:0] code;
  wire [5:0] code;
  wire [31:0] valcmp;
  wire [31:0] valcmp;
  wire CF,NF,VF,ZF;
  wire CF,NF,VF,ZF;
 
 
Line 33... Line 34...
  assign valres=(code==8) ? val1 + val2            : 32'bz;
  assign valres=(code==8) ? val1 + val2            : 32'bz;
  assign valres=(code==9) ? val1 + const1 : 32'bz;
  assign valres=(code==9) ? val1 + const1 : 32'bz;
  assign valres=(code==10)? val1 - val2            : 32'bz;
  assign valres=(code==10)? val1 - val2            : 32'bz;
  assign valres=(code==11)? val1 - const1 : 32'bz;
  assign valres=(code==11)? val1 - const1 : 32'bz;
  assign valres=wrspec ? val1 : 32'bz;
  assign valres=wrspec ? val1 : 32'bz;
 
  assign valres=(code==12 && instr[15:11]==5'd2 && instr[31:24]=8'hff) ? irq_bits : 32'bz;
  assign valres=(code==13)? val1 & {16'b1111111111111111, const1[15:0]} : 32'bz;
  assign valres=(code==13)? val1 & {16'b1111111111111111, const1[15:0]} : 32'bz;
  assign valres=(code==46) ? retaddr : 32'bz;
  assign valres=(code==46) ? retaddr : 32'bz;
  assign valres=(code==14)? val1 << val2[5:0] : 32'bz;
  assign valres=(code==14)? val1 << val2[5:0] : 32'bz;
  assign valres=(code==15)? val1 << const1[5:0] : 32'bz;
  assign valres=(code==15)? val1 << const1[5:0] : 32'bz;
  assign valres=(code==16)? val1 >> val2[5:0] : 32'bz;
  assign valres=(code==16)? val1 >> val2[5:0] : 32'bz;
Line 44... Line 46...
  assign valres=(code==18)? {32{val1[31]},val1} >> val2[5:0] : 32'bz;
  assign valres=(code==18)? {32{val1[31]},val1} >> val2[5:0] : 32'bz;
  assign valres=(code==19)? {32{val1[31]},val1} >> const1[5:0] : 32'bz;
  assign valres=(code==19)? {32{val1[31]},val1} >> const1[5:0] : 32'bz;
 
 
  assign valres=wrtval | wrspec ? 32'bz : 32'b0;
  assign valres=wrtval | wrspec ? 32'bz : 32'b0;
 
 
  assign wrtval=((code<=11) || (code>=13 && code<=19) || (code==46));
  assign wrtval=((code<=11) || (code>=13 && code<=19) || (code==46)) || (code==12 && instr[15:11]==5'd2 && instr[31:24]=8'hff);
  assign wrspec=(code==12) && (instr[15:6]=10'd1);
  assign wrspec=(code==12) && (instr[15:11]=5'd1);
 
 
  //flags for compare &jump
  //flags for compare &jump
  assign {CF,valcmp}=val1 - val2;
  assign {CF,valcmp}=val1 - val2;
  assign NF=valcmp[31];
  assign NF=valcmp[31];
  assign ZF=(val1==val2);
  assign ZF=(val1==val2);
Line 384... Line 386...
 
 
  reg [15:0] irq_bits=16'b0;
  reg [15:0] irq_bits=16'b0;
  reg [31:0] irq_handler=32'hffff_fff0;
  reg [31:0] irq_handler=32'hffff_fff0;
 
 
  wire wrspec;
  wire wrspec;
 
  reg [31:0] sys_flags=32'b0;
 
  reg [15:0] irq_mask;
 
 
  //dataunit data0(clk,stall,stginhibit,readaddr,readdata,agureadsz,agureaden,aguwriteen,opB);
  //dataunit data0(clk,stall,stginhibit,readaddr,readdata,agureadsz,agureaden,aguwriteen,opB);
  datacache datacache0(clk,stall,stginhibit,codeMiss,dcAddr,dcDataA,busInput,opB,dcHit,dcReadEn,dcWriteEn,dcInsert,dcInitEntry,agureadsz,dcOldAddr);
  datacache datacache0(clk,stall,stginhibit,codeMiss,dcAddr,dcDataA,busInput,opB,dcHit,dcReadEn,dcWriteEn,dcInsert,dcInitEntry,agureadsz,dcOldAddr);
  regfileint0 regf0(clk,intregwe,rA,rB,rC,rF,intregdataA,intregdataB,intregdataC,intregdataF);
  regfileint0 regf0(clk,intregwe,rA,rB,rC,rF,intregdataA,intregdataB,intregdataC,intregdataF);
  aluplus alu0(instr4,opA,opB,opF,aluwrtval,alucjmpinstr,alucjmp,constBits4,retAddr,wrspec);
  aluplus alu0(instr4,opA,opB,opF,aluwrtval,alucjmpinstr,alucjmp,constBits4,retAddr,wrspec,irq_bits);
  ioinstr ioinstr0(clk,stall,stginhibit,instr4,opA,opB,ioInstrResult,wasGlobalStall,ioInstrWrtVal,ioInstrDoStall,ioInstrKeepStalling,
  ioinstr ioinstr0(clk,stall,stginhibit,instr4,opA,opB,ioInstrResult,wasGlobalStall,ioInstrWrtVal,ioInstrDoStall,ioInstrKeepStalling,
                   ioBusAddr,ioBusSize,ioBusOut,ioBusIn,ioBusRdy,ioBusWr,ioBusRd);
                   ioBusAddr,ioBusSize,ioBusOut,ioBusIn,ioBusRdy,ioBusWr,ioBusRd);
  subagu agu0(clk,stall,stginhibit,opC,instr0,instr,instr4,aguaddr,aguwrtval,agustall,agureadsz,agureaden,aguwriteen,constBits);
  subagu agu0(clk,stall,stginhibit,opC,instr0,instr,instr4,aguaddr,aguwrtval,agustall,agureadsz,agureaden,aguwriteen,constBits);
  brpred brpred0(clk,stall,stginhibit,fetchaddr,brpred_hit,brpred_instr,brpred_nextaddr,brpred_taken,
  brpred brpred0(clk,stall,stginhibit,fetchaddr,brpred_hit,brpred_instr,brpred_nextaddr,brpred_taken,
                 brpred_instertaddr,brpred_instertinstr,brpred_insertnextaddr,brpred_inserttaken,brpred_jumpinstr,brpred_addrMismatch);
                 brpred_instertaddr,brpred_instertinstr,brpred_insertnextaddr,brpred_inserttaken,brpred_jumpinstr,brpred_addrMismatch);
Line 543... Line 547...
          cycle1prev<=1;
          cycle1prev<=1;
          IP<=fetchaddr+4;
          IP<=fetchaddr+4;
          IP2<=fetchaddr;
          IP2<=fetchaddr;
          multiCycleStall[1]<=multiCycleStall[0];
          multiCycleStall[1]<=multiCycleStall[0];
          multiCycleStall[0]<=0;
          multiCycleStall[0]<=0;
          if (irq)
          if (irq&irq_mask)
            begin
            begin
              stginhibit<=5'b11110;
              stginhibit<=5'b11110;
              codeMiss<=0;
              codeMiss<=0;
              IP<=irq_handler;
              IP<=irq_handler;
              irq_bits<=irq;
              irq_bits<=irq;
Line 666... Line 670...
              IP<=IP5;
              IP<=IP5;
              multiCycleStall[0]<=1;
              multiCycleStall[0]<=1;
            end
            end
          else if (wrspec)
          else if (wrspec)
            begin
            begin
              case (instr4[31:16])
              case (instr4[31:24])
                16'd0: irq_handler<=opF;
                8'd0: irq_handler<=opF;
 
                8'd1: sys_flags<=opF;
 
                8'd2: irq_mask<=opF;
              endcase
              endcase
            end
            end
        end
        end
      else
      else
        begin
        begin

powered by: WebSVN 2.1.0

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