📄 i8051_lib.vhd
字号:
constant ALU_OPC_RRC : UNSIGNED (3 downto 0) := "1101"; constant ALU_OPC_PCSADD : UNSIGNED (3 downto 0) := "1110"; constant ALU_OPC_PCUADD : UNSIGNED (3 downto 0) := "1111"; constant OPC_ACALL : UNSIGNED (6 downto 0) := "0000000"; constant OPC_ADD_1 : UNSIGNED (6 downto 0) := "0000001"; constant OPC_ADD_2 : UNSIGNED (6 downto 0) := "0000010"; constant OPC_ADD_3 : UNSIGNED (6 downto 0) := "0000011"; constant OPC_ADD_4 : UNSIGNED (6 downto 0) := "0000100"; constant OPC_ADDC_1 : UNSIGNED (6 downto 0) := "0000101"; constant OPC_ADDC_2 : UNSIGNED (6 downto 0) := "0000110"; constant OPC_ADDC_3 : UNSIGNED (6 downto 0) := "0000111"; constant OPC_ADDC_4 : UNSIGNED (6 downto 0) := "0001000"; constant OPC_AJMP : UNSIGNED (6 downto 0) := "0001001"; constant OPC_ANL_1 : UNSIGNED (6 downto 0) := "0001010"; constant OPC_ANL_2 : UNSIGNED (6 downto 0) := "0001011"; constant OPC_ANL_3 : UNSIGNED (6 downto 0) := "0001100"; constant OPC_ANL_4 : UNSIGNED (6 downto 0) := "0001101"; constant OPC_ANL_5 : UNSIGNED (6 downto 0) := "0001110"; constant OPC_ANL_6 : UNSIGNED (6 downto 0) := "0001111"; constant OPC_ANL_7 : UNSIGNED (6 downto 0) := "0010000"; constant OPC_ANL_8 : UNSIGNED (6 downto 0) := "0010001"; constant OPC_CJNE_1 : UNSIGNED (6 downto 0) := "0010010"; constant OPC_CJNE_2 : UNSIGNED (6 downto 0) := "0010011"; constant OPC_CJNE_3 : UNSIGNED (6 downto 0) := "0010100"; constant OPC_CJNE_4 : UNSIGNED (6 downto 0) := "0010101"; constant OPC_CLR_1 : UNSIGNED (6 downto 0) := "0010110"; constant OPC_CLR_2 : UNSIGNED (6 downto 0) := "0010111"; constant OPC_CLR_3 : UNSIGNED (6 downto 0) := "0011000"; constant OPC_CPL_1 : UNSIGNED (6 downto 0) := "0011001"; constant OPC_CPL_2 : UNSIGNED (6 downto 0) := "0011010"; constant OPC_CPL_3 : UNSIGNED (6 downto 0) := "0011011"; constant OPC_DA : UNSIGNED (6 downto 0) := "0011100"; constant OPC_DEC_1 : UNSIGNED (6 downto 0) := "0011101"; constant OPC_DEC_2 : UNSIGNED (6 downto 0) := "0011110"; constant OPC_DEC_3 : UNSIGNED (6 downto 0) := "0011111"; constant OPC_DEC_4 : UNSIGNED (6 downto 0) := "0100000"; constant OPC_DIV : UNSIGNED (6 downto 0) := "0100001"; constant OPC_DJNZ_1 : UNSIGNED (6 downto 0) := "0100010"; constant OPC_DJNZ_2 : UNSIGNED (6 downto 0) := "0100011"; constant OPC_INC_1 : UNSIGNED (6 downto 0) := "0100100"; constant OPC_INC_2 : UNSIGNED (6 downto 0) := "0100101"; constant OPC_INC_3 : UNSIGNED (6 downto 0) := "0100110"; constant OPC_INC_4 : UNSIGNED (6 downto 0) := "0100111"; constant OPC_INC_5 : UNSIGNED (6 downto 0) := "0101000"; constant OPC_JB : UNSIGNED (6 downto 0) := "0101001"; constant OPC_JBC : UNSIGNED (6 downto 0) := "0101010"; constant OPC_JC : UNSIGNED (6 downto 0) := "0101011"; constant OPC_JMP : UNSIGNED (6 downto 0) := "0101100"; constant OPC_JNB : UNSIGNED (6 downto 0) := "0101101"; constant OPC_JNC : UNSIGNED (6 downto 0) := "0101110"; constant OPC_JNZ : UNSIGNED (6 downto 0) := "0101111"; constant OPC_JZ : UNSIGNED (6 downto 0) := "0110000"; constant OPC_LCALL : UNSIGNED (6 downto 0) := "0110001"; constant OPC_LJMP : UNSIGNED (6 downto 0) := "0110010"; constant OPC_MOV_1 : UNSIGNED (6 downto 0) := "0110011"; constant OPC_MOV_2 : UNSIGNED (6 downto 0) := "0110100"; constant OPC_MOV_3 : UNSIGNED (6 downto 0) := "0110101"; constant OPC_MOV_4 : UNSIGNED (6 downto 0) := "0110110"; constant OPC_MOV_5 : UNSIGNED (6 downto 0) := "0110111"; constant OPC_MOV_6 : UNSIGNED (6 downto 0) := "0111000"; constant OPC_MOV_7 : UNSIGNED (6 downto 0) := "0111001"; constant OPC_MOV_8 : UNSIGNED (6 downto 0) := "0111010"; constant OPC_MOV_9 : UNSIGNED (6 downto 0) := "0111011"; constant OPC_MOV_10 : UNSIGNED (6 downto 0) := "0111100"; constant OPC_MOV_11 : UNSIGNED (6 downto 0) := "0111101"; constant OPC_MOV_12 : UNSIGNED (6 downto 0) := "0111110"; constant OPC_MOV_13 : UNSIGNED (6 downto 0) := "0111111"; constant OPC_MOV_14 : UNSIGNED (6 downto 0) := "1000000"; constant OPC_MOV_15 : UNSIGNED (6 downto 0) := "1000001"; constant OPC_MOV_16 : UNSIGNED (6 downto 0) := "1000010"; constant OPC_MOV_17 : UNSIGNED (6 downto 0) := "1000011"; constant OPC_MOV_18 : UNSIGNED (6 downto 0) := "1000100"; constant OPC_MOVC_1 : UNSIGNED (6 downto 0) := "1000101"; constant OPC_MOVC_2 : UNSIGNED (6 downto 0) := "1000110"; constant OPC_MOVX_1 : UNSIGNED (6 downto 0) := "1000111"; constant OPC_MOVX_2 : UNSIGNED (6 downto 0) := "1001000"; constant OPC_MOVX_3 : UNSIGNED (6 downto 0) := "1001001"; constant OPC_MOVX_4 : UNSIGNED (6 downto 0) := "1001010"; constant OPC_MUL : UNSIGNED (6 downto 0) := "1001011"; constant OPC_NOP : UNSIGNED (6 downto 0) := "1001100"; constant OPC_ORL_1 : UNSIGNED (6 downto 0) := "1001101"; constant OPC_ORL_2 : UNSIGNED (6 downto 0) := "1001110"; constant OPC_ORL_3 : UNSIGNED (6 downto 0) := "1001111"; constant OPC_ORL_4 : UNSIGNED (6 downto 0) := "1010000"; constant OPC_ORL_5 : UNSIGNED (6 downto 0) := "1010001"; constant OPC_ORL_6 : UNSIGNED (6 downto 0) := "1010010"; constant OPC_ORL_7 : UNSIGNED (6 downto 0) := "1010011"; constant OPC_ORL_8 : UNSIGNED (6 downto 0) := "1010100"; constant OPC_POP : UNSIGNED (6 downto 0) := "1010101"; constant OPC_PUSH : UNSIGNED (6 downto 0) := "1010110"; constant OPC_RET : UNSIGNED (6 downto 0) := "1010111"; constant OPC_RETI : UNSIGNED (6 downto 0) := "1011000"; constant OPC_RL : UNSIGNED (6 downto 0) := "1011001"; constant OPC_RLC : UNSIGNED (6 downto 0) := "1011010"; constant OPC_RR : UNSIGNED (6 downto 0) := "1011011"; constant OPC_RRC : UNSIGNED (6 downto 0) := "1011100"; constant OPC_SETB_1 : UNSIGNED (6 downto 0) := "1011101"; constant OPC_SETB_2 : UNSIGNED (6 downto 0) := "1011110"; constant OPC_SJMP : UNSIGNED (6 downto 0) := "1011111"; constant OPC_SUBB_1 : UNSIGNED (6 downto 0) := "1100000"; constant OPC_SUBB_2 : UNSIGNED (6 downto 0) := "1100001"; constant OPC_SUBB_3 : UNSIGNED (6 downto 0) := "1100010"; constant OPC_SUBB_4 : UNSIGNED (6 downto 0) := "1100011"; constant OPC_SWAP : UNSIGNED (6 downto 0) := "1100100"; constant OPC_XCH_1 : UNSIGNED (6 downto 0) := "1100101"; constant OPC_XCH_2 : UNSIGNED (6 downto 0) := "1100110"; constant OPC_XCH_3 : UNSIGNED (6 downto 0) := "1100111"; constant OPC_XCHD : UNSIGNED (6 downto 0) := "1101000"; constant OPC_XRL_1 : UNSIGNED (6 downto 0) := "1101001"; constant OPC_XRL_2 : UNSIGNED (6 downto 0) := "1101010"; constant OPC_XRL_3 : UNSIGNED (6 downto 0) := "1101011"; constant OPC_XRL_4 : UNSIGNED (6 downto 0) := "1101100"; constant OPC_XRL_5 : UNSIGNED (6 downto 0) := "1101101"; constant OPC_XRL_6 : UNSIGNED (6 downto 0) := "1101110"; constant OPC_ERROR : UNSIGNED (6 downto 0) := "1101111"; constant OPC_NU1 : UNSIGNED (6 downto 0) := "1110000"; constant OPC_NU2 : UNSIGNED (6 downto 0) := "1110001"; constant OPC_NU3 : UNSIGNED (6 downto 0) := "1110010"; constant OPC_NU4 : UNSIGNED (6 downto 0) := "1110011"; constant OPC_NU5 : UNSIGNED (6 downto 0) := "1111100"; constant OPC_NU6 : UNSIGNED (6 downto 0) := "1111101"; constant OPC_NU7 : UNSIGNED (6 downto 0) := "1111110"; constant OPC_NU8 : UNSIGNED (6 downto 0) := "1111111"; function CONV_UNSIGNED(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return UNSIGNED;end I8051_LIB;library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;package body I8051_LIB is -- Find minimum between 2 integers function min(L, R: INTEGER) return INTEGER is begin if L < R then return L; else return R; end if; end; -- Produce UNSIGNED type from STD_LOGIC_VECTOR function MAKE_BINARY(A : STD_LOGIC_VECTOR) return UNSIGNED is variable result : UNSIGNED (A'range); begin for i in A'range loop case A(i) is when '0' | 'L' => result(i) := '0'; when '1' | 'H' => result(i) := '1'; when others => null; end case; end loop; return result; end; -- Convert from STD_LOGIC_VECTOR to UNSIGNED type of specified width function CONV_UNSIGNED(ARG: STD_LOGIC_VECTOR; SIZE: INTEGER) return UNSIGNED is constant msb: INTEGER := min(ARG'length, SIZE) - 1; subtype rtype is UNSIGNED (SIZE-1 downto 0); variable new_bounds : UNSIGNED (ARG'length-1 downto 0); variable result: rtype; begin new_bounds := MAKE_BINARY(ARG); result := CONV_UNSIGNED(0,SIZE); result(msb downto 0) := new_bounds(msb downto 0); return result; end;end I8051_LIB;--------------------------------------------------------------------------------- end of file ---- Synthesizable VHDL generated by VHDL Module Generator--
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -