?? oc8051_defines.v
字號:
////////////////////////////////////////////////////////////////////////// //////// 8051 cores Definitions //////// //////// This file is part of the 8051 cores project //////// http://www.opencores.org/cores/8051/ //////// //////// Description //////// 8051 definitions. //////// //////// To Do: //////// Nothing //////// //////// Author(s): //////// - Simon Teran, simont@opencores.org //////// - Jaka Simsic, jakas@opencores.org //////// ////////////////////////////////////////////////////////////////////////////// //////// Copyright (C) 2000 Authors and OPENCORES.ORG //////// //////// This source file may be used and distributed without //////// restriction provided that this copyright statement is not //////// removed from the file and that any derivative work contains //////// the original copyright notice and the associated disclaimer. //////// //////// This source file is free software; you can redistribute it //////// and/or modify it under the terms of the GNU Lesser General //////// Public License as published by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any //////// later version. //////// //////// This source is distributed in the hope that it will be //////// useful, but WITHOUT ANY WARRANTY; without even the implied //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //////// PURPOSE. See the GNU Lesser General Public License for more //////// details. //////// //////// You should have received a copy of the GNU Lesser General //////// Public License along with this source; if not, download it //////// from http://www.opencores.org/lgpl.shtml //////// ////////////////////////////////////////////////////////////////////////////// ver: 1////// operation codes for alu//`define OC8051_ALU_NOP 4'b0000`define OC8051_ALU_ADD 4'b0001`define OC8051_ALU_SUB 4'b0010`define OC8051_ALU_MUL 4'b0011`define OC8051_ALU_DIV 4'b0100`define OC8051_ALU_DA 4'b0101`define OC8051_ALU_NOT 4'b0110`define OC8051_ALU_AND 4'b0111`define OC8051_ALU_XOR 4'b1000`define OC8051_ALU_OR 4'b1001`define OC8051_ALU_RL 4'b1010`define OC8051_ALU_RLC 4'b1011`define OC8051_ALU_RR 4'b1100`define OC8051_ALU_RRC 4'b1101`define OC8051_ALU_PCS 4'b1110`define OC8051_ALU_XCH 4'b1111//// sfr addresses//`define OC8051_SFR_ACC 8'he0 //accumulator`define OC8051_SFR_B 8'hf0 //b register`define OC8051_SFR_PSW 8'hd0 //program status word`define OC8051_SFR_P0 8'h80 //port 0`define OC8051_SFR_P1 8'h90 //port 1`define OC8051_SFR_P2 8'ha0 //port 2`define OC8051_SFR_P3 8'hb0 //port 3`define OC8051_SFR_DPTR_LO 8'h82 // data pointer high bits`define OC8051_SFR_DPTR_HI 8'h83 // data pointer low bits`define OC8051_SFR_IP 8'hb8 // interrupt priority control`define OC8051_SFR_IE 8'ha8 // interrupt enable control`define OC8051_SFR_TMOD 8'h89 // timer/counter mode`define OC8051_SFR_TCON 8'h88 // timer/counter control`define OC8051_SFR_TH0 8'h8c // timer/counter 0 high bits`define OC8051_SFR_TL0 8'h8a // timer/counter 0 low bits`define OC8051_SFR_TH1 8'h8d // timer/counter 1 high bits`define OC8051_SFR_TL1 8'h8b // timer/counter 1 low bits`define OC8051_SFR_SCON 8'h98 // serial control`define OC8051_SFR_SBUF 8'h98 // serial data buffer`define OC8051_SFR_SP 8'h81 // stack pointer//// sfr bit addresses//`define OC8051_SFR_B_ACC 5'b11100 //accumulator`define OC8051_SFR_B_PSW 5'b11010 //program status word`define OC8051_SFR_B_P0 5'b10000 //port 0`define OC8051_SFR_B_P1 5'b10010 //port 1`define OC8051_SFR_B_P2 5'b10100 //port 2`define OC8051_SFR_B_P3 5'b10110 //port 3//// alu source select//`define OC8051_ASS_RAM 2'b00 // RAM`define OC8051_ASS_ACC 2'b01 // accumulator`define OC8051_ASS_XRAM 2'b10 // external RAM -- source1`define OC8051_ASS_ZERO 2'b10 // 8'h00 -- source2`define OC8051_ASS_IMM 2'b11 // immediate data -- source1`define OC8051_ASS_OP2 2'b11 // pc low -- source2`define OC8051_ASS_DC 2'bxx ////// alu source 3 select//`define OC8051_AS3_PC 1'b1 // program clunter`define OC8051_AS3_DP 1'b0 // data pointer`define OC8051_AS3_DC 1'bx //////carry input in alu//`define OC8051_CY_0 2'b00 // 1'b0;`define OC8051_CY_PSW 2'b01 // carry from psw`define OC8051_CY_RAM 2'b10 // carry from ram`define OC8051_CY_1 2'b11 // 1'b1;`define OC8051_CY_DC 2'bxx // carry from psw//// instruction set////op_code [4:0]`define OC8051_ACALL 5'b1_0001 // absolute call`define OC8051_AJMP 5'b0_0001 // absolute jump//op_code [7:3]`define OC8051_ADD_R 8'b0010_1xxx // add A=A+Rx`define OC8051_ADDC_R 8'b0011_1xxx // add A=A+Rx+c`define OC8051_ANL_R 8'b0101_1xxx // and A=A^Rx`define OC8051_CJNE_R 8'b1011_1xxx // compare and jump if not equal; Rx<>constant`define OC8051_DEC_R 8'b0001_1xxx // decrement reg Rn=Rn-1`define OC8051_DJNZ_R 8'b1101_1xxx // decrement and jump if not zero`define OC8051_INC_R 8'b0000_1xxx // increment Rn`define OC8051_MOV_R 8'b1110_1xxx // move A=Rn`define OC8051_MOV_AR 8'b1111_1xxx // move Rn=A`define OC8051_MOV_DR 8'b1010_1xxx // move Rn=(direct)`define OC8051_MOV_CR 8'b0111_1xxx // move Rn=constant`define OC8051_MOV_RD 8'b1000_1xxx // move (direct)=Rn`define OC8051_ORL_R 8'b0100_1xxx // or A=A or Rn`define OC8051_SUBB_R 8'b1001_1xxx // substract with borrow A=A-c-Rn`define OC8051_XCH_R 8'b1100_1xxx // exchange A<->Rn`define OC8051_XRL_R 8'b0110_1xxx // XOR A=A XOR Rn//op_code [7:1]`define OC8051_ADD_I 8'b0010_011x // add A=A+@Ri`define OC8051_ADDC_I 8'b0011_011x // add A=A+@Ri+c`define OC8051_ANL_I 8'b0101_011x // and A=A^@Ri`define OC8051_CJNE_I 8'b1011_011x // compare and jump if not equal; @Ri<>constant`define OC8051_DEC_I 8'b0001_011x // decrement indirect @Ri=@Ri-1`define OC8051_INC_I 8'b0000_011x // increment @Ri`define OC8051_MOV_I 8'b1110_011x // move A=@Ri`define OC8051_MOV_ID 8'b1000_011x // move (direct)=@Ri`define OC8051_MOV_AI 8'b1111_011x // move @Ri=A`define OC8051_MOV_DI 8'b1010_011x // move @Ri=(direct)`define OC8051_MOV_CI 8'b0111_011x // move @Ri=constant`define OC8051_MOVX_IA 8'b1110_001x // move A=(@Ri)`define OC8051_MOVX_AI 8'b1111_001x // move (@Ri)=A`define OC8051_ORL_I 8'b0100_011x // or A=A or @Ri`define OC8051_SUBB_I 8'b1001_011x // substract with borrow A=A-c-@Ri`define OC8051_XCH_I 8'b1100_011x // exchange A<->@Ri`define OC8051_XCHD 8'b1101_011x // exchange digit A<->Ri`define OC8051_XRL_I 8'b0110_011x // XOR A=A XOR @Ri//op_code [7:0]`define OC8051_ADD_D 8'b0010_0101 // add A=A+(direct)`define OC8051_ADD_C 8'b0010_0100 // add A=A+constant`define OC8051_ADDC_D 8'b0011_0101 // add A=A+(direct)+c`define OC8051_ADDC_C 8'b0011_0100 // add A=A+constant+c`define OC8051_ANL_D 8'b0101_0101 // and A=A^(direct)`define OC8051_ANL_C 8'b0101_0100 // and A=A^constant`define OC8051_ANL_DD 8'b0101_0010 // and (direct)=(direct)^A`define OC8051_ANL_DC 8'b0101_0011 // and (direct)=(direct)^constant`define OC8051_ANL_B 8'b1000_0010 // and c=c^bit`define OC8051_ANL_NB 8'b1011_0000 // and c=c^!bit`define OC8051_CJNE_D 8'b1011_0101 // compare and jump if not equal; a<>(direct)`define OC8051_CJNE_C 8'b1011_0100 // compare and jump if not equal; a<>constant`define OC8051_CLR_A 8'b1110_0100 // clear accumulator`define OC8051_CLR_C 8'b1100_0011 // clear carry`define OC8051_CLR_B 8'b1100_0010 // clear bit`define OC8051_CPL_A 8'b1111_0100 // complement accumulator`define OC8051_CPL_C 8'b1011_0011 // complement carry`define OC8051_CPL_B 8'b1011_0010 // complement bit`define OC8051_DA 8'b1101_0100 // decimal adjust (A)`define OC8051_DEC_A 8'b0001_0100 // decrement accumulator a=a-1`define OC8051_DEC_D 8'b0001_0101 // decrement direct (direct)=(direct)-1`define OC8051_DIV 8'b1000_0100 // divide`define OC8051_DJNZ_D 8'b1101_0101 // decrement and jump if not zero (direct)`define OC8051_INC_A 8'b0000_0100 // increment accumulator`define OC8051_INC_D 8'b0000_0101 // increment (direct)`define OC8051_INC_DP 8'b1010_0011 // increment data pointer
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -