Professional Documents
Culture Documents
Thiet Ke 8051 Intel Su Dung VHDL PDF
Thiet Ke 8051 Intel Su Dung VHDL PDF
Din n
Bi mi
PIC16F690-E/SO
Forum Actions
Chc nng
Din n
+ Tr li bi vit
ti: thiet ke 8051 Intel su dung VHDL
LinkBack
S dng ty chn
Search Thread
nh gi
#1
21-05-09 13:36
hungthientu
Thnh vin tch cc
Ni C Ng: Reverse
Engineering Academy
-------------------------------------------------------------------------------
Bi vit:
package I8051_LIB is
156
Mentioned: 0 Post(s)
Tagged:
0 Thread(s)
Display
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
1/26
19/09/2013
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
2/26
19/09/2013
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
constant
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
3/26
19/09/2013
rst (active hi) : alu outputs don't car values during reset
op_code : defines the alu operation (see I8051_LIB)
src_1 : first source operand of the alu
src_2 : second source operand of the alu
src_3 : third source operand of the alu
src_cy : carry into the 7th bit of the alu
src_ac : carry into the 4th bit of the alu
des_1 : first destination operand of the alu
des_2 : second destination operand of the alu
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
4/26
19/09/2013
v5
v6
v7
v8
v9
vA
vB
vC
r(7)
r(6)
r(5)
r(4)
r(3)
r(2)
r(1)
r(0)
:= vC(0);
:= v8(2);
:= v8(1);
:= v8(0);
:= v4(3);
:= v4(2);
:= v4(1);
:= v4(0);
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
5/26
19/09/2013
r(0) := v4(0);
cy := vC(1);
ac := v4(4);
ov := vC(1) xor v8(3);
end DO_ADD;
v5
v6
v7
v8
v9
vA
vB
vC
r(7) := vC(0);
r(6) := v8(2);
r(5) := v8(1);
r(4) := v8(0);
r(3) := v4(3);
r(2) := v4(2);
r(1) := v4(1);
r(0) := v4(0);
cy := not vC(1);
ac := not v4(4);
ov := (not vC(1)) xor (not v8(3));
end DO_SUB;
------------------------------------------------------------------------------procedure DO_MUL(a, b : in UNSIGNED (7 downto 0);
r : out UNSIGNED (15 downto 0);
ov : out STD_LOGIC) is
variable v1 : UNSIGNED (15 downto 0);
begin
v1 := a * b;
r := v1;
if( v1(15 downto 8) /= C0_8 ) then
ov := '1';
else
ov := '0';
end if;
end DO_MUL;
------------------------------------------------------------------------------procedure DO_DIV(a, b : in UNSIGNED (7 downto 0);
r : out UNSIGNED (15 downto 0);
ov : out STD_LOGIC) is
variable v1 : UNSIGNED (15 downto 0);
variable v2, v3 : UNSIGNED (8 downto 0);
begin
if( b = C0_8 ) then
r(7 downto 0) := CD_8;
r(15 downto 8) := CD_8;
ov := '1';
elsif( a = b ) then
r(7 downto 0) := C1_8;
r(15 downto 8) := C0_8;
ov := '0';
elsif( a < b ) then
r(7 downto 0) := C0_8;
r(15 downto 8) := src_1;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
6/26
19/09/2013
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
7/26
19/09/2013
src_2(7);
src_2(6);
src_2(5);
src_2(4);
src_2(3);
src_2(2);
src_2(1);
src_2(0);
src_2(7);
src_2(6);
src_2(5);
src_2(4);
src_2(3);
src_2(2);
src_2(1);
src_2(0);
src_2(7);
src_2(6);
src_2(5);
src_2(4);
src_2(3);
src_2(2);
src_2(1);
src_2(0);
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
8/26
19/09/2013
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
9/26
19/09/2013
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
&
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
10/26
19/09/2013
Cm n | Chia s
Tr li
21-05-09 13:38
hungthientu
Thnh vin tch cc
156
Mentioned: 0 Post(s)
Tagged:
0 Thread(s)
i8051_ram.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use WORK.I8051_LIB.all;
--------------------------------------------------------------------------------- rst (active hi) : when asserted, the registers are set to default values
-- clk (rising edge) : clock signal - all ram i/o is synchronous
-- addr : this is the address of ram/reg being requested
-- in_data : this is the data being writen into the ram/reg
-- out_data : this is the data being read from the ram/reg
-- in_bit_data : this is the bit-data being writen into the ram/reg
-- out_bit_data : this is the bit-data being read from the ram/reg
-- rd (active lo) : asserted to signal a ram/reg read
-- wr (active lo) : asserted to signal a ram/reg write
-- is_bit_addr (active hi) : asserted if requesting a ram/reg bit-data
-- p0_in : write access to the 8051's port 0
-- p0_out : read access to the 8051's port 0
-- p1_in : write access to the 8051's port 0
-- p1_out : read access to the 8051's port 0
-- p2_in : write access to the 8051's port 0
-- p2_out : read access to the 8051's port 0
-- p3_in : write access to the 8051's port 0
-- p3_out : read access to the 8051's port 0
-entity I8051_RAM is
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
addr : in UNSIGNED (7 downto 0);
in_data : in UNSIGNED (7 downto 0);
out_data : out UNSIGNED (7 downto 0);
in_bit_data : in STD_LOGIC;
out_bit_data : out STD_LOGIC;
rd : in STD_LOGIC;
wr : in STD_LOGIC;
is_bit_addr : in STD_LOGIC;
p0_in : in UNSIGNED (7 downto 0);
p0_out : out UNSIGNED (7 downto 0);
p1_in : in UNSIGNED (7 downto 0);
p1_out : out UNSIGNED (7 downto 0);
p2_in : in UNSIGNED (7 downto 0);
p2_out : out UNSIGNED (7 downto 0);
p3_in : in UNSIGNED (7 downto 0);
p3_out : out UNSIGNED (7 downto 0));
end I8051_RAM;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
11/26
19/09/2013
begin
process(rst, clk)
------------------------------------------------------------------------------procedure GET_BYTE (a : UNSIGNED (7 downto 0);
v : out UNSIGNED (7 downto 0)) is
begin
case a is
when R_B => v := sfr_b;
when R_ACC => v := sfr_acc;
when R_PSW => v := sfr_psw;
when R_IP => v := sfr_ip;
when R_IE => v := sfr_ie;
when R_SP => v := sfr_sp;
when R_P0 => v := p0_in;
when R_P1 => v := p1_in;
when R_P2 => v := p2_in;
when R_P3 => v := p3_in;
when R_DPL => v := sfr_dpl;
when R_DPH => v := sfr_dph;
when R_PCON => v := sfr_pcon;
when R_SCON => v := sfr_scon;
when R_SBUF => v := sfr_sbuf;
when R_TCON => v := sfr_tcon;
when R_TMOD => v := sfr_tmod;
when R_TL0 => v := sfr_tl0;
when R_TL1 => v := sfr_tl1;
when R_TH0 => v := sfr_th0;
when R_TH1 => v := sfr_th1;
when others => v := iram(conv_integer(a(6 downto 0)));
end case;
end GET_BYTE;
------------------------------------------------------------------------------procedure SET_BYTE (a : UNSIGNED (7 downto 0);
v : UNSIGNED (7 downto 0)) is
begin
case a is
when R_B => sfr_b <= v;
when R_ACC => sfr_acc <= v;
when R_PSW => sfr_psw <= v;
when R_IP => sfr_ip <= v;
when R_IE => sfr_ie <= v;
when R_SP => sfr_sp <= v;
when R_P0 => p0_out <= v;
when R_P1 => p1_out <= v;
when R_P2 => p2_out <= v;
when R_P3 => p3_out <= v;
when R_DPL => sfr_dpl <= v;
when R_DPH => sfr_dph <= v;
when R_PCON => sfr_pcon <= v;
when R_SCON => sfr_scon <= v;
when R_SBUF => sfr_sbuf <= v;
when R_TCON => sfr_tcon <= v;
when R_TMOD => sfr_tmod <= v;
when R_TL0 => sfr_tl0 <= v;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
12/26
19/09/2013
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
13/26
19/09/2013
-- LJMP
-- MOV_9
-- MOV_9
-- MOV_9
-- MOV_9
------
CLR_1
MOV_5
MOV_1
CLR_2
SUBB_2
-- JNC
-- MOV_6
-- MOV_1
-- CLR_2
-- SUBB_2
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
14/26
19/09/2013
"00010101",
"01010000",
"00111011",
"10101011",
"00010010",
"10101010",
"00010011",
"10101001",
"00010100",
"10001110",
"10000010",
"01110101",
"10000011",
"00000000",
"00010010",
"00000001",
"11001111",
"11111101",
"10001111",
"10000010",
"01110101",
"10000011",
"00000000",
"00010010",
"00000001",
"11001111",
"11111100",
"11010011",
"10011101",
"01000000",
"00011100",
"10001100",
"00010110",
"10001110",
"10000010",
"01110101",
"10000011",
"00000000",
"00010010",
"00000001",
"11001111",
"10001111",
"10000010",
"01110101",
"10000011",
"00000000",
"00010010",
"00000001",
"11111100",
"10001110",
"10000010",
"01110101",
"10000011",
"00000000",
"11100101",
"00010110",
"00010010",
"00000001",
"11111100",
"00001110",
"10000000",
"10111111",
"00001111",
"10000000",
"10110100",
"11100100",
"11110101",
"10000000",
"00100010",
"10001011",
"00010010",
"10001010",
"00010011",
"10001001",
"00010100",
"10001101",
"00010101",
"11100100",
"11110101",
"00010110",
"10101101",
"00010110",
"11101101",
"00110011",
"10010101",
"11100000",
"11111100",
"11000011",
MOV_5
SETB_1
SUBB_1
JC
-- MOV_9
-- MOV_9
-- MOV_12
-- LCALL
-- MOV_9
-- MOV_12
-- LCALL
-- MOV_9
-- MOV_12
-- MOV_2
-- LCALL
-- INC_2
-- SJMP
-- INC_2
-- SJMP
-- CLR_1
-- MOV_8
-- RET
-- MOV_9
-- MOV_9
-- MOV_9
-- MOV_9
-- CLR_1
-- MOV_8
-- MOV_6
-- MOV_1
-- RLC
-- SUBB_2
-- MOV_5
-- CLR_2
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
15/26
19/09/2013
"11000011",
"11101101",
"10010101",
"00010101",
"01110100",
"10000000",
"11111000",
"01101100",
"10011000",
"01010000",
"00011001",
"10101011",
"00010010",
"10101010",
"00010011",
"10101001",
"00010100",
"10101111",
"00010110",
"11101111",
"00110011",
"10010101",
"11100000",
"10001111",
"10000010",
"11110101",
"10000011",
"00010010",
"00000001",
"11001111",
"11110101",
"10000000",
"00000101",
"00010110",
"10000000",
"11010101",
"00100010",
"01111000",
"00001000",
"01111100",
"00000000",
"01111101",
"00000000",
"01111011",
"11111111",
"01111010",
"00000000",
"01111001",
"11000000",
"01111110",
"00000000",
"01111111",
"00001010",
"00010010",
"00000001",
"10100110",
"01111011",
"00000000",
"01111010",
"00000000",
"01111001",
"00001000",
"01111101",
"00001010",
"00010010",
"00000000",
"00000011",
"01111011",
"00000000",
"01111010",
"00000000",
"01111001",
"00001000",
"01111101",
"00001010",
"00010010",
"00000000",
"01011101",
"10000000",
"11111110",
"00100010",
"00010011",
"00010010",
"00010001",
"00010000",
"00001111",
"00001110",
"00001101",
-- CLR_2
-- MOV_1
-- SUBB_2
-- MOV_4
-----
MOV_5
XRL_1
SUBB_1
JNC
-- MOV_6
-- MOV_6
-- MOV_6
-- MOV_6
-- MOV_1
-- RLC
-- SUBB_2
-- MOV_9
-- MOV_8
-- LCALL
-- MOV_8
-- INC_3
-- SJMP
-- RET
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- LCALL
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- LCALL
-- MOV_7
-- MOV_7
-- MOV_7
-- MOV_7
-- LCALL
-- SJMP
-- RET
-- RRC
-- LCALL
-- INC_2
-- INC_2
-- INC_2
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
16/26
19/09/2013
------
INC_2
INC_2
INC_2
INC_2
MOV_7
-- CLR_1
-- MOV_13
-- DJNZ_1
-- MOV_12
-- LJMP
------
MOV_3
INC_2
MOV_13
INC_2
DJNZ_1
-- SJMP
------
MOV_3
INC_2
MOVX_3
INC_2
DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
------
MOV_3
INC_2
MOVX_4
INC_5
DJNZ_1
-- SJMP
------
MOVX_1
INC_2
MOV_13
INC_2
DJNZ_1
-- SJMP
------
MOVX_1
INC_2
MOVX_3
INC_2
DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
------
MOVX_1
INC_2
MOVX_4
INC_5
DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
------
MOVX_2
INC_5
MOV_13
INC_2
DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
17/26
19/09/2013
------
MOVX_2
INC_5
MOVX_3
INC_2
DJNZ_1
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- SJMP
-- MOV_9
-- MOV_9
--------
MOV_1
MOV_5
CLR_1
MOVC_1
INC_5
XCH_1
XCH_2
-- XCH_1
-- XCH_1
-- XCH_2
------
XCH_1
MOVX_4
INC_5
XCH_1
XCH_2
-- XCH_1
-- XCH_1
-- XCH_2
-- XCH_1
-- DJNZ_1
-- DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
-------
CLR_1
MOVC_1
INC_5
MOV_13
INC_2
DJNZ_1
-- MOV_1
-- MOV_5
-- MOV_6
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
18/26
19/09/2013
-- MOV_6
-----
MOV_1
MOV_5
RET
MOV_9
-- MOV_9
-------
MOV_1
MOV_5
MOVX_2
INC_5
XCH_1
XCH_2
-- XCH_1
-- XCH_1
-- XCH_2
------
XCH_1
MOVX_4
INC_5
XCH_1
XCH_2
-- XCH_1
-- XCH_1
-- XCH_2
-- XCH_1
-- DJNZ_1
-- DJNZ_1
-- SJMP
-- MOV_9
-- MOV_9
-------
CLR_1
MOVC_1
INC_5
MOVX_3
INC_2
DJNZ_1
-- SJMP
-- MOV_9
-- MOV_1
-- ADD_4
-- CJNE_2
-- JNC
-- MOV_8
-- MOV_1
-- ADD_4
-- CJNE_2
-- JNC
-- RL
-- RL
-- ORL_2
-- MOV_8
-- MOV_1
-- ORL_1
-- JZ
-- MOV_1
-- JZ
-- INC_2
-- MOV_2
-- RL
-- MOV_18
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
19/26
19/09/2013
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
20/26
19/09/2013
Cm n | Chia s
Tr li
21-05-09 20:01
hungthientu
Thnh vin tch cc
156
Mentioned: 0 Post(s)
Tagged:
0 Thread(s)
i8051_all.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use WORK.I8051_LIB.all;
--------------------------------------------------------------------------------- rst (active hi) : resets the 8051
-- clk (rising edge) : clocks the 8051
-- xrm_addr : this is the address of xram being requested
-- xrm_out_data : this is the data sent to the xram
-- xrm_in_data : this is the data received from the xram
-- xrm_rd (active lo) : asserted to signal a xram read
-- xrm_wr (active lo) : asserted to signal a xram write
-- p0_in : port 0's input direction
-- p0_out : port 0's output direction
-- p0_in : port 1's input direction
-- p0_out : port 1's output direction
-- p0_in : port 2's input direction
-- p0_out : port 2's output direction
-- p0_in : port 3's input direction
-- p0_out : port 3's output direction
-entity I8051_ALL is
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
xrm_addr : out UNSIGNED (15 downto 0);
xrm_out_data : out UNSIGNED (7 downto 0);
xrm_in_data : in UNSIGNED (7 downto 0);
xrm_rd : out STD_LOGIC;
xrm_wr : out STD_LOGIC;
p0_in : in UNSIGNED (7 downto 0);
p0_out : out UNSIGNED (7 downto 0);
p1_in : in UNSIGNED (7 downto 0);
p1_out : out UNSIGNED (7 downto 0);
p2_in : in UNSIGNED (7 downto 0);
p2_out : out UNSIGNED (7 downto 0);
p3_in : in UNSIGNED (7 downto 0);
p3_out : out UNSIGNED (7 downto 0));
end I8051_ALL;
------------------------------------------------------------------------------architecture STR of I8051_ALL is
component I8051_ALU
port(rst : in STD_LOGIC;
op_code : in UNSIGNED (3 downto 0);
src_1 : in UNSIGNED (7 downto 0);
src_2 : in UNSIGNED (7 downto 0);
src_3 : in UNSIGNED (7 downto 0);
src_cy : in STD_LOGIC;
src_ac : in STD_LOGIC;
des_1 : out UNSIGNED (7 downto 0);
des_2 : out UNSIGNED (7 downto 0);
des_cy : out STD_LOGIC;
des_ac : out STD_LOGIC;
des_ov : out STD_LOGIC);
end component;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
21/26
19/09/2013
end component;
component I8051_DEC
port(rst : in STD_LOGIC;
op_in : in UNSIGNED (7 downto 0);
op_out : out UNSIGNED (8 downto 0));
end component;
component I8051_RAM
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
addr : in UNSIGNED (7 downto 0);
in_data : in UNSIGNED (7 downto 0);
out_data : out UNSIGNED (7 downto 0);
in_bit_data : in STD_LOGIC;
out_bit_data : out STD_LOGIC;
rd : in STD_LOGIC;
wr : in STD_LOGIC;
is_bit_addr : in STD_LOGIC;
p0_in : in UNSIGNED (7 downto 0);
p0_out : out UNSIGNED (7 downto 0);
p1_in : in UNSIGNED (7 downto 0);
p1_out : out UNSIGNED (7 downto 0);
p2_in : in UNSIGNED (7 downto 0);
p2_out : out UNSIGNED (7 downto 0);
p3_in : in UNSIGNED (7 downto 0);
p3_out : out UNSIGNED (7 downto 0));
end component;
component I8051_ROM
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
addr : in UNSIGNED (11 downto 0);
data : out UNSIGNED (7 downto 0);
rd : in STD_LOGIC);
end component;
component I8051_CTR
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
rom_addr : out UNSIGNED (11 downto 0);
rom_data : in UNSIGNED (7 downto 0);
rom_rd : out STD_LOGIC;
ram_addr : out UNSIGNED (7 downto 0);
ram_out_data : out UNSIGNED (7 downto 0);
ram_in_data : in UNSIGNED (7 downto 0);
ram_out_bit_data : out STD_LOGIC;
ram_in_bit_data : in STD_LOGIC;
ram_rd : out STD_LOGIC;
ram_wr : out STD_LOGIC;
ram_is_bit_addr : out STD_LOGIC;
xrm_addr : out UNSIGNED (15 downto 0);
xrm_out_data : out UNSIGNED (7 downto 0);
xrm_in_data : in UNSIGNED (7 downto 0);
xrm_rd : out STD_LOGIC;
xrm_wr : out STD_LOGIC;
dec_op_out : out UNSIGNED (7 downto 0);
dec_op_in : in UNSIGNED (8 downto 0);
alu_op_code : out UNSIGNED (3 downto 0);
alu_src_1 : out UNSIGNED (7 downto 0);
alu_src_2 : out UNSIGNED (7 downto 0);
alu_src_3 : out UNSIGNED (7 downto 0);
alu_src_cy : out STD_LOGIC;
alu_src_ac : out STD_LOGIC;
alu_des_1 : in UNSIGNED (7 downto 0);
alu_des_2 : in UNSIGNED (7 downto 0);
alu_des_cy : in STD_LOGIC;
alu_des_ac : in STD_LOGIC;
alu_des_ov : in STD_LOGIC);
end component;
-- synopsys_synthesis off
component I8051_DBG
port(op_in : in UNSIGNED (8 downto 0));
end component;
-- synopsys_synthesis on
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
22/26
19/09/2013
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
signal
begin
ram_is_bit_addr : STD_LOGIC;
dec_op_out : UNSIGNED (7 downto 0);
dec_op_in : UNSIGNED (8 downto 0);
alu_op_code : UNSIGNED (3 downto 0);
alu_src_1 : UNSIGNED (7 downto 0);
alu_src_2 : UNSIGNED (7 downto 0);
alu_src_3 : UNSIGNED (7 downto 0);
alu_src_cy : STD_LOGIC;
alu_src_ac : STD_LOGIC;
alu_des_1 : UNSIGNED (7 downto 0);
alu_des_2 : UNSIGNED (7 downto 0);
alu_des_cy : STD_LOGIC;
alu_des_ac : STD_LOGIC;
alu_des_ov : STD_LOGIC;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
23/26
19/09/2013
alu_des_ac,
alu_des_ov);
-- synopsys_synthesis off
U_DBG : I8051_DBG port map(dec_op_in);
-- synopsys_synthesis on
end STR;
-------------------------------------------------------------------------------- end of file -i8051_xrm.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use WORK.I8051_LIB.all;
--------------------------------------------------------------------------------- rst (active hi) : when asserted, the registers are set to default values
-- clk (rising edge) : clock signal - all ram i/o is synchronous
-- addr : this is the address of ram/reg being requested
-- in_data : this is the data being writen into the ram/reg
-- out_data : this is the data being read from the ram/reg
-- rd (active lo) : asserted to signal a ram/reg read
-- wr (active lo) : asserted to signal a ram/reg write
-entity I8051_XRM is
generic(storage_size : INTEGER := 2048);
port(rst : in STD_LOGIC;
clk : in STD_LOGIC;
addr : in UNSIGNED (15 downto 0);
in_data : in UNSIGNED (7 downto 0);
out_data : out UNSIGNED (7 downto 0);
rd : in STD_LOGIC;
wr : in STD_LOGIC);
end I8051_XRM;
------------------------------------------------------------------------------architecture BHV of I8051_XRM is
type XRM_TYPE is array (0 to storage_size-1) of UNSIGNED (7 downto 0);
signal xrm : XRM_TYPE;
begin
process(rst, clk)
begin
if( rst = '1' ) then
for i in 0 to storage_size-1 loop
xrm(i) <= CD_8;
end loop;
out_data <= CD_8;
elsif( clk'event and clk = '1' ) then
if( rd = '1' and conv_integer(addr) < storage_size ) then
out_data <= xrm(conv_integer(addr));
elsif( wr = '1' and conv_integer(addr) < storage_size ) then
xrm(conv_integer(addr)) <= in_data;
end if;
end if;
end process;
end BHV;
-------------------------------------------------------------------------------- end of file -i8051_tsb.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
------------------------------------------------------------------------------entity I8051_TSB is
end I8051_TSB;
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
24/26
19/09/2013
end I8051_TSB;
Cm n | Chia s
Tr li
+ Tr li bi vit
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
25/26
19/09/2013
Gi bi tr li
Tr li chi tit
Hu b
th
th
th
th
gi lung mi
tr li bi
gi file nh km
sa bi vit ca mnh
StumbleUpon
Google
BB code is M
Smilies ang M
[IMG] ang M
[VIDEO] code is M
HTML ang Tt
Trackbacks are M
Pingbacks are M
Refbacks are M
Forum Rules
www.dientuvietnam.net/forums/gal-pal-cpld-fpga-59/thiet-ke-8051-intel-su-dung-vhdl-25112/
26/26