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

Subversion Repositories 8051

[/] [8051/] [trunk/] [rtl/] [verilog/] [oc8051_decoder.v] - Diff between revs 46 and 54

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

Rev 46 Rev 54
Line 43... Line 43...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.11  2002/09/30 17:33:59  simont
 
// prepared header
 
//
//
//
 
 
// synopsys translate_off
// synopsys translate_off
`include "oc8051_timescale.v"
`include "oc8051_timescale.v"
// synopsys translate_on
// synopsys translate_on
Line 56... Line 59...
 
 
 
 
module oc8051_decoder (clk, rst, op_in, eq, ram_rd_sel, ram_wr_sel, bit_addr,
module oc8051_decoder (clk, rst, op_in, eq, ram_rd_sel, ram_wr_sel, bit_addr,
wr, src_sel1, src_sel2, src_sel3, alu_op, psw_set, cy_sel, imm_sel, pc_wr,
wr, src_sel1, src_sel2, src_sel3, alu_op, psw_set, cy_sel, imm_sel, pc_wr,
pc_sel, comp_sel, rom_addr_sel, ext_addr_sel, wad2, rd, we_o, reti,
pc_sel, comp_sel, rom_addr_sel, ext_addr_sel, wad2, rd, we_o, reti,
rmw, stb_o, ack_i, wr_xaddr);
rmw, stb_o, ack_i, wr_xaddr, istb, ea, iack);
 
 
//
//
// clk          (in)  clock
// clk          (in)  clock
// rst          (in)  reset
// rst          (in)  reset
// op_in        (in)  operation code [oc8051_op_select.op1]
// op_in        (in)  operation code [oc8051_op_select.op1]
// eq           (in)  compare result [oc8051_comp.eq]
// eq           (in)  compare result [oc8051_comp.eq]
Line 83... Line 87...
// ext_addr_sel (out) external address select (dptr or Ri) [oc8051_ext_addr_sel.select]
// ext_addr_sel (out) external address select (dptr or Ri) [oc8051_ext_addr_sel.select]
// rd           (out) read from rom [oc8051_pc.rd, oc8051_op_select.rd]
// rd           (out) read from rom [oc8051_pc.rd, oc8051_op_select.rd]
// we_o         (out) write to external rom [pin]
// we_o         (out) write to external rom [pin]
// reti         (out) return from interrupt [pin]
// reti         (out) return from interrupt [pin]
// rmw          (out) read modify write feature [oc8051_ports.rmw]
// rmw          (out) read modify write feature [oc8051_ports.rmw]
 
// istb         (out) strobe to instruction rom
 
// ea           (in)  extrnal access
 
// iack         (in)  scknowlage from external rom
//
//
 
 
input clk, rst, eq, ack_i;
input clk, rst, eq, ack_i, iack, ea;
input [7:0] op_in;
input [7:0] op_in;
 
 
output wr, reti, we_o, bit_addr, src_sel3, rom_addr_sel, ext_addr_sel,
output wr, reti, we_o, bit_addr, src_sel3, rom_addr_sel, ext_addr_sel,
pc_wr, wad2, rmw, stb_o, wr_xaddr;
pc_wr, wad2, rmw, stb_o, wr_xaddr, istb;
output [1:0] ram_rd_sel, src_sel1, src_sel2, psw_set, cy_sel, pc_sel, comp_sel;
output [1:0] ram_rd_sel, src_sel1, src_sel2, psw_set, cy_sel, pc_sel, comp_sel;
output [2:0] ram_wr_sel, imm_sel;
output [2:0] ram_wr_sel, imm_sel;
output [3:0] alu_op;
output [3:0] alu_op;
output rd;
output rd;
 
 
reg reti, write_x, rmw, stb_buff, we_buff;
reg reti, write_x, rmw, stb_buff, we_buff, istb_t;
reg wr,  bit_addr, src_sel3, rom_addr_sel, ext_addr_sel, pc_wr, wad2, stb, stbw, wr_xaddr;
reg wr,  bit_addr, src_sel3, rom_addr_sel, ext_addr_sel, pc_wr, wad2, stb, stbw, wr_xaddr;
reg [1:0] comp_sel, psw_set, ram_rd_sel, src_sel1, src_sel2, pc_sel, cy_sel;
reg [1:0] comp_sel, psw_set, ram_rd_sel, src_sel1, src_sel2, pc_sel, cy_sel;
reg [3:0] alu_op;
reg [3:0] alu_op;
reg [2:0] ram_wr_sel, imm_sel;
reg [2:0] ram_wr_sel, imm_sel;
 
 
Line 111... Line 118...
 
 
//
//
// if state = 2'b00 then read nex instruction
// if state = 2'b00 then read nex instruction
assign rd = !state[0] && !state[1] && !stb_o;
assign rd = !state[0] && !state[1] && !stb_o;
 
 
 
assign istb = (!state[1]) || istb_t;
 
 
assign stb_o = stb_buff || stbw;
assign stb_o = stb_buff || stbw;
assign we_o = we_buff;
assign we_o = we_buff;
//assign we_o = write_x || we_buff;
//assign we_o = write_x || we_buff;
 
 
//
//
// main block
// main block
// case of instruction set control signals
// case of instruction set control signals
always @(op_in or eq or state or op or stb_o)
always @(op_in or eq or state or op or stb_o or istb_t)
begin
begin
  if (stb_o) begin
  if (stb_o) begin
          ram_rd_sel = `OC8051_RRS_DC;
          ram_rd_sel = `OC8051_RRS_DC;
          ram_wr_sel = `OC8051_RWS_DC;
          ram_wr_sel = `OC8051_RWS_DC;
          src_sel1 = `OC8051_ASS_DC;
          src_sel1 = `OC8051_ASS_DC;
Line 3049... Line 3058...
// in case of instructions that needs more than one clock set state
// in case of instructions that needs more than one clock set state
always @(posedge clk or posedge rst)
always @(posedge clk or posedge rst)
begin
begin
  if (rst)
  if (rst)
    state <= #1 2'b01;
    state <= #1 2'b01;
  else begin
  else if (istb_t && !iack) begin
 
    state <= #1 2'b01;
 
  end else begin
    case (state)
    case (state)
      2'b10: state <= #1 2'b01;
      2'b10: state <= #1 2'b01;
      2'b11: state <= #1 2'b10;
      2'b11: state <= #1 2'b10;
      2'b00:
      2'b00:
        casex (op_in)
        casex (op_in)
Line 3181... Line 3192...
    we_buff <= #1 1'b1;
    we_buff <= #1 1'b1;
  end
  end
end
end
 
 
 
 
 
always @(posedge clk or posedge rst)
 
begin
 
  if (rst)
 
    istb_t <= #1 1'b0;
 
  else if (((op_in == `OC8051_MOVC_DP) || (op_in == `OC8051_MOVC_PC)) && !ea)
 
    istb_t <= #1 1'b1;
 
  else if (iack)
 
    istb_t <= #1 1'b0;
 
end
 
 
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.