EDA365电子工程师网
标题:
MC8051 IP core
[打印本页]
作者:
zgq800712
时间:
2008-11-20 08:08
标题:
MC8051 IP core
在网上寻找数字地与模拟地的英文材料;
' j, M- ` d; c
无意间浏览到一个国外的的CPLD/FPGA论坛,点击进入
D6 n1 p3 {7 r h8 t
发现了有人求51的IP CORE,在回帖里面看到这个,所以下载了。
6 M! L3 g i& Z# h1 r
9 {$ h, n0 K0 a
* v1 P/ ]5 X0 x. f+ x! `& ?1 c
@:
mc8051@oregano.at
) z" B+ T0 f4 p$ W& t% g) b0 _
W:
http://oregano.at/ip/8051.htm
2 Y0 N# i2 d: N7 e
9 {2 Z" k( S) b& S8 |$ j3 H+ ?
************************************************************
; W. S8 K B9 ^; Y1 v# [/ {
This is version 1.4 of the MC8051 IP core.
9 {; O. A/ v1 A
November 2004: Oregano Systems - Design & Consulting GesmbH
" V6 r" i: Z1 _1 }6 E9 I# v
============================================================
6 h! B* ^/ ?; ^: Y S
Changes:
2 G& T2 X# t: o1 N; N
- corrected behaviour of RETI instruction handling
4 C. g; A! F" ~" _
- added synchronization for interrupt signals
$ `1 ^1 \0 f6 E& U; o7 F' Z: Y6 k
- corrected timer problems
* e/ _! z1 t8 @( s4 |
- q+ e. i# Q9 Q
************************************************************
1 c ]% d+ P/ m: m( j
This is version 1.3 of the MC8051 IP core.
1 ? u+ x; {9 v0 [& i0 p
September 2002: Oregano Systems - Design & Consulting GesmbH
& B5 H& \9 K; N G% G
============================================================
! b: t r; e9 F! x
Change history:
, p0 j* b0 u. K7 _5 b" m
- Improved tb_mc8051_siu_sim.vhd to verify duplex operation.
% P1 J$ O/ X5 o
- Corrected problem with duplex operation in file
, x% z: A" p( v% N0 v! E
mc8051_siu_rtl.vhd
; s: F- k8 l; w4 e# j6 h$ U
& u4 O; p! S1 ?1 L2 R
************************************************************
0 q2 w" J+ y! c7 _" _
This is version 1.2. of the MC8051 IP core.
( s9 [+ @$ F s# @
June 2002 - Oregano Systems - Design & Consulting GesmbH
7 [9 C5 c/ ?0 E6 }
============================================================
7 T- p; s- d' S4 x
Change history:
' ]3 e/ A: I7 Q) ^6 Y
- Eliminated the scr subdirectory form the distribution.
f, X# n0 R$ P2 J" k2 a& s! h
- Improved documentation.
2 i+ x" y f" {2 B0 u9 e
- Corrected several bugs in the source code (see the
+ q0 t5 Z) w% R8 h* M
website for more details).
! E$ L9 c$ y% G6 `
- Improved the testbench with respect to the I/O port
! ^: b! H; d. y1 r W
behavior.
- C4 F8 R# f& Q/ {0 o2 J" r. W9 e
- Enriched the msim directory with the assembler source
( A7 q v( D" p1 t1 o
code of an example program.
c6 w- t3 M/ {
- Provided the source code of a Intel hex to binary
8 M4 S6 R7 g: i
textfile converter to ease simulation of the user's
" Z. N5 q% l1 f' K) P* _7 ^) e
assambler programs.
+ t5 ?9 f5 f2 W: ?& y# }3 s
; \1 J8 i" w$ v4 e$ }/ E" J
************************************************************
. d4 k" _+ z# ]" K7 y# V
This is version 1.1. of the MC8051 IP core.
" x X8 I, x; Y2 ^1 o
Jan 31st 2002 - Oregano Systems - Design & Consulting GesmbH
0 ~2 `( Y `! k# n- O
1 I. l6 c% ]+ p' Q5 b' i6 m
9 [! }' M. _- [3 L
6 `+ o+ S+ D, N; Y6 N8 y( y6 S& s
下面是里面的部分VHDL
2 w- x& l. D d$ H1 m. l& L
. i; G. O. b, S9 c
' k/ a4 ?% ^# \7 t+ c, F: k
+ U, U" g5 l( d/ A) l" W
library IEEE;
9 _9 q; w D' v
use IEEE.std_logic_1164.all;
# L7 N; T' u* w- P1 e# n8 O1 i$ Y
use IEEE.std_logic_arith.all;
- t& X$ ?6 l% L1 c- ]- M
library work;
3 B1 t# E: a4 b8 W4 }* p2 `
use work.mc8051_p.all;
+ w3 E) T' B6 d" a* [2 E Z. n
( O. E- k1 @0 T7 C* x; ^
-----------------------------ENTITY DECLARATION--------------------------------
, W6 i8 V+ C$ R6 e
entity addsub_core is
( Y. D$ T9 n$ [+ ^& E/ I4 z( L
: L! R6 O" h' z! z; M; ~$ s* Z
generic (DWIDTH : integer := 16); -- Data width of the ALU
# b, W. ?* a% i3 K! q
port (opa_i : in std_logic_vector(DWIDTH-1 downto 0);
|# \' Z% O4 ]/ K
opb_i : in std_logic_vector(DWIDTH-1 downto 0);
* C7 ^' f* t) S0 m1 S0 W8 D
addsub_i : in std_logic;
" ?2 A7 a3 @ O5 @$ A$ `
cy_i : in std_logic;
% G( H( l% \9 G( v( T! X
cy_o : out std_logic_vector((DWIDTH-1)/4 downto 0);
7 z2 c( V; o% J8 J- B' p4 l
ov_o : out std_logic;
# f( w( R! v! S* y& O: h/ M/ B
rslt_o : out std_logic_vector(DWIDTH-1 downto 0));
' t* l; ]" ~0 F$ I8 G
7 D; a- }3 V2 g
end addsub_core;
& Z0 A D8 {, I8 S9 R& z; ^6 d/ i
+ e% ~. t. }* S/ w
2 G: ]1 A5 e4 V1 G1 |) i
$ w3 a# u3 W4 q
entity mc8051_alu is
$ x1 P* o+ U+ ]8 V
generic (DWIDTH : integer := 8); -- Data width of the ALU
. N" C; U% o* O, @) m4 ^2 f/ D- D& e
port (rom_data_i : in std_logic_vector(DWIDTH-1 downto 0);
4 k( L4 i+ _7 b+ w
ram_data_i : in std_logic_vector(DWIDTH-1 downto 0);
0 Z9 n$ W5 w A ~7 Q" n
acc_i : in std_logic_vector(DWIDTH-1 downto 0);
( K" E- W C9 m" J
cmd_i : in std_logic_vector(5 downto 0);
6 i! @9 c [5 i' o* f. `
cy_i : in std_logic_vector((DWIDTH-1)/4 downto 0);
( [( R6 J# M9 l1 w
ov_i : in std_logic;
9 E1 z7 J0 J; u$ n& d8 ]
6 t2 Y, f' b! M+ K2 q8 R8 o
new_cy_o : out std_logic_vector((DWIDTH-1)/4 downto 0);
0 B- ~1 R9 [' n
new_ov_o : out std_logic;
! H; y/ b3 i" I* d$ o6 x
result_a_o : out std_logic_vector(DWIDTH-1 downto 0);
; Q4 ]7 X' Q+ ]' z7 Q5 e. V. w
result_b_o : out std_logic_vector(DWIDTH-1 downto 0));
. v, e6 l4 D& Q, t
/ b8 j9 h. h6 S7 ^) M6 o, \, k
end mc8051_alu;
( B3 Q5 c" H% @* _
--Inputs:
( i/ b. t2 P, @4 J2 `3 I
-- rom_data_i...... data input from ROM
3 e% D Y) t; T% n- J) f# E h h
-- ram_data_i...... data input from RAM
0 Z4 t% P! M9 C! x
-- acc_i........... the contents of the accumulator register
7 ~/ \: P- ^9 O
-- cmd_i........... command from the control unit
9 E3 W4 x# x9 T! X
-- cy_i............ CY-Flags of the SFR
* U) N* P+ r* x; U V
-- ov_i............ OV-Flag of the SFR
# ^, C3 A$ W' d! }/ d2 G
--Outputs:
( }4 Z; |$ y# l6 z: l
-- new_cy_o........ new CY-Flags for SFR
. V, [; l: e. w# X
-- new_ov_o........ new OV-Flag for SFR
; M0 V& q* c2 X O) k
-- result_a_o...... result
& A7 V4 c7 u: s; Q% I
-- result_b_o...... result
2 X& O0 e% w% ~* u" D& M" r5 B+ p
# E2 O, S: z% J% t7 b8 A
+ ^0 |& C5 p* F) j, M- L. a: E
' M3 E( J9 [) B5 U' D
5 d/ E* ^0 ^6 A2 D
architecture struc of mc8051_alu is
& _! S8 K( h* F$ y2 f8 {7 P
signal s_alu_result : std_logic_vector(DWIDTH-1 downto 0);
9 Y+ a) i7 h0 y, n! p
signal s_alu_new_cy : std_logic_vector((DWIDTH-1)/4 downto 0);
. f3 \: o' Q* b5 t; L
signal s_alu_op_a : std_logic_vector(DWIDTH-1 downto 0);
7 d, T. T5 J# ~4 J8 R4 {1 Q
signal s_alu_op_b : std_logic_vector(DWIDTH-1 downto 0);
% |, M( m ]7 o+ O$ _
signal s_alu_cmd : std_logic_vector(3 downto 0);
6 ?. q0 n. E7 x- U
signal s_dvdnd : std_logic_vector(DWIDTH-1 downto 0);
% x' h6 {$ F) S5 Q
signal s_dvsor : std_logic_vector(DWIDTH-1 downto 0);
3 c5 j& H! O P5 h8 D+ _; Y
signal s_qutnt : std_logic_vector(DWIDTH-1 downto 0);
1 [3 A* e; I) Z7 G$ T+ ^1 E! g M* d- \
signal s_rmndr : std_logic_vector(DWIDTH-1 downto 0);
. Y; i/ o7 n3 h) G3 \
signal s_mltplcnd : std_logic_vector(DWIDTH-1 downto 0);
1 @5 k( v) g& ~' {" H
signal s_mltplctr : std_logic_vector(DWIDTH-1 downto 0);
( d/ Z, r4 `, [: w& D
signal s_product : std_logic_vector((DWIDTH*2)-1 downto 0);
W1 Z. p3 D A2 R
signal s_dcml_data : std_logic_vector(DWIDTH-1 downto 0);
$ ]/ c. \% Y3 _- o
signal s_dcml_rslt : std_logic_vector(DWIDTH-1 downto 0);
4 v R$ Z% a" _1 _/ P
signal s_dcml_cy : std_logic;
2 W6 A3 j2 h6 T$ \( l
signal s_addsub_rslt : std_logic_vector(DWIDTH-1 downto 0);
$ u3 u( {2 q5 l" q- I
signal s_addsub_newcy : std_logic_vector((DWIDTH-1)/4 downto 0);
+ U* o* {$ `* B4 f2 s; a" A) h% E3 p
signal s_addsub_ov : std_logic;
$ Q2 S5 {, E) O0 D
signal s_addsub_cy : std_logic;
9 X ?: {, D9 m$ o; E$ ?1 i
signal s_addsub : std_logic;
# \& _2 A$ o- r4 Q
signal s_addsub_opa : std_logic_vector(DWIDTH-1 downto 0);
- f2 I/ s# H2 ?+ k( E9 f2 O
signal s_addsub_opb : std_logic_vector(DWIDTH-1 downto 0);
1 ?0 |; E3 q& w6 _; N
begin -- architecture structural
0 p6 n) Y4 h1 e5 n& [5 q/ P
i_alumux : alumux
# X4 S' b3 L* `6 @! e! t, j
generic map (
3 G& ]) \: M+ h: r
DWIDTH => DWIDTH)
& Q, ?% J5 u" T1 o/ X0 J
port map (
# }3 J% m; T- ^& w; g- B) g! v
-- Primary I/Os of the ALU unit.
* W1 l" @: W- Y u7 g
rom_data_i => rom_data_i,
b) E2 p. \! A9 s
ram_data_i => ram_data_i,
b! w7 p* q) C( |: R- O
acc_i => acc_i,
6 g3 b( o, | ^) f: B+ a4 f
cmd_i => cmd_i,
$ I; G# I( ~5 I9 i( i$ G' }7 B
cy_i => cy_i,
7 z; D/ s% b8 p/ v* {! E
ov_i => ov_i,
$ `: C9 Y* U9 N
cy_o => new_cy_o,
4 Y' E8 {2 m r9 S) F: U9 @
ov_o => new_ov_o,
( O8 K! M7 S7 D8 i e
result_a_o => result_a_o,
/ R* V- ?( I7 C" d( A; V* e6 N* r2 e
result_b_o => result_b_o,
) o, ?8 {3 W9 d8 \' N F
-- I/Os connecting the submodules.
) G: h i7 B1 S7 u
result_i => s_alu_result,
3 `. K. z5 j1 I+ Z ]
new_cy_i => s_alu_new_cy,
6 }& B6 T$ Q( q; M
addsub_rslt_i => s_addsub_rslt,
8 {0 Q' E- n1 x- i$ S% X) ^
addsub_cy_i => s_addsub_newcy,
9 S+ d, s3 |: _* [. }1 h1 O
addsub_ov_i => s_addsub_ov,
8 M- q8 q; y( S, c2 t( k
op_a_o => s_alu_op_a,
! B* ~) k% W$ t, d9 A; ?
op_b_o => s_alu_op_b,
9 u c8 q+ W5 G4 t
alu_cmd_o => s_alu_cmd,
; g! F8 T7 ~$ x o+ c! u, _: l
opa_o => s_addsub_opa,
$ X- ~8 M# h' v# `% ?
opb_o => s_addsub_opb,
- e* h1 i0 s( c9 H2 b3 q
addsub_o => s_addsub,
" l8 V0 W7 W5 k; e9 F o7 H& e
addsub_cy_o => s_addsub_cy,
! @) W2 p) E7 a5 Y+ U
dvdnd_o => s_dvdnd,
2 D }6 n: G; O% }" l/ P1 N6 G1 N
dvsor_o => s_dvsor,
E4 g8 \' I9 _) o
qutnt_i => s_qutnt,
3 H8 j, Y! Q& {2 U5 o- l' k
rmndr_i => s_rmndr,
# V/ p5 R2 P) _* b
mltplcnd_o => s_mltplcnd,
, n0 f" J9 ^- m. k/ [0 Y! _
mltplctr_o => s_mltplctr,
, c* ^# h ^/ f! k& ^
product_i => s_product,
- ]- ^# r3 i* y) \
dcml_data_o => s_dcml_data,
% j, `; n; o; \* q. ^* ~
dcml_data_i => s_dcml_rslt,
+ t5 f& w: r* k- [0 i' @
dcml_cy_i => s_dcml_cy);
' M# m6 g& u" K$ K- x1 G
i_alucore : alucore
8 |. E2 M1 f& O6 g% F
generic map (
) ^( ^! n) g: t* x& U5 E
DWIDTH => DWIDTH)
( q/ O% T4 o+ w, d8 X
port map (
& r2 T" D9 w, {7 C8 ?. z& S7 u
op_a_i => s_alu_op_a,
' I3 h- _1 P8 p9 j, }
op_b_i => s_alu_op_b,
; e) W8 r/ ^; l# w+ I) w( e+ n# c* |
alu_cmd_i => s_alu_cmd,
5 U9 |/ d5 r; P; M6 M( t1 L6 J
cy_i => cy_i,
! d+ M9 O- c" I2 C9 [" }5 U- Q5 k
cy_o => s_alu_new_cy,
; k: p5 ^* r$ G# p8 T2 I' [% |
result_o => s_alu_result);
' ` G K X6 _7 D, _2 _
i_addsub_core : addsub_core
) S$ P5 \* t0 s7 D* P( _
generic map (DWIDTH => DWIDTH)
4 j' I2 C! E( Q- Q' a) k
port map (opa_i => s_addsub_opa,
8 t* T' {! d: P$ o3 W( u5 z
opb_i => s_addsub_opb,
+ e3 y7 D: w* O" M0 w& r7 M
addsub_i => s_addsub,
; q- j ? Y' W# Y! ]# {
cy_i => s_addsub_cy,
, h2 O+ w& e4 F% d
cy_o => s_addsub_newcy,
3 x+ i2 }% \7 E3 z# y
ov_o => s_addsub_ov,
1 Q: T g" ?8 H
rslt_o => s_addsub_rslt);
; ?+ O' M2 A s( N
gen_multiplier1 : if C_IMPL_MUL = 1 generate
/ f5 F; [& C+ H* S$ |; y
i_comb_mltplr : comb_mltplr
" M% [. C' j5 L. [5 X$ J L
generic map (
2 ` m" B V( P& v8 f
DWIDTH => DWIDTH)
8 W/ x% K2 ^9 ~7 y) o/ N( L
port map (
1 S# P x5 y' |" J
mltplcnd_i => s_mltplcnd,
+ Z6 `" ]! |' R4 g& h* n; B
mltplctr_i => s_mltplctr,
1 p ~2 ]( ^) f" z( C
product_o => s_product);
* H' D5 }% y# r+ S5 [
end generate gen_multiplier1;
+ i# N% k& a0 F6 d
gen_multiplier0 : if C_IMPL_MUL /= 1 generate
N, G1 u3 D$ K
s_product <= (others => '0');
" I- M5 v, Q( l! v0 [
end generate gen_multiplier0;
7 ~$ e0 y- u. n+ P
gen_divider1 : if C_IMPL_DIV = 1 generate
% D3 W0 `' O0 W' N% }9 l6 `. f3 S
i_comb_divider : comb_divider
4 D9 X% S& ^- n+ C1 j- i
generic map (
+ N9 p- u: f5 F5 H0 s* X
DWIDTH => DWIDTH)
- N5 s, W3 W3 W5 j4 F* x4 r
port map (
4 c# D1 Z% ~% k
dvdnd_i => s_dvdnd,
. \2 V) W2 `+ h1 Z2 J6 t8 P3 U( _' s
dvsor_i => s_dvsor,
$ K/ i( F+ b5 x
qutnt_o => s_qutnt,
9 p" O4 W3 ^6 N2 `8 l
rmndr_o => s_rmndr);
, B. ^) F5 r# I
end generate gen_divider1;
" F; `& {- {; J4 D5 N5 K
gen_divider0 : if C_IMPL_DIV /= 1 generate
, g2 z6 M$ ]8 ^) {4 K3 L
s_qutnt <= (others => '0');
8 K) r2 z6 C) j; O4 ?5 n1 R& m
s_rmndr <= (others => '0');
( s, y4 c& K7 b4 k0 F
end generate gen_divider0;
* S% a+ p: F* L( j& N* e
gen_dcml_adj1 : if C_IMPL_DA = 1 generate
D2 \ n6 C$ F/ D
i_dcml_adjust : dcml_adjust
$ o% Z( I7 J$ F7 ~6 y
generic map (
9 |8 n& k" |+ C3 n" e9 Y
DWIDTH => DWIDTH)
8 M" G/ m8 j O3 ]; r
port map (
9 e N/ [0 M; Q, ]3 b
data_i => s_dcml_data,
7 h; s" T5 ?# s' `
cy_i => cy_i,
- r" n$ d4 I9 P
data_o => s_dcml_rslt,
O" W2 t6 F9 b
cy_o => s_dcml_cy);
. a' p; W% B! a! K- P! n4 m
end generate gen_dcml_adj1;
7 N3 h2 s* S1 K, e, m! z9 m
gen_dcml_adj0 : if C_IMPL_DA /= 1 generate
% D6 s; U* N) Y; h
s_dcml_rslt <= (others => '0');
( T/ `8 F2 Y6 k* O1 _
s_dcml_cy <= '0';
% y. V# M& T9 f8 s+ E; K
end generate gen_dcml_adj0;
0 W; M0 o$ k; N. n9 p. T( ?/ ~
end struc;
mc8051_design.rar
2008-11-20 08:08 上传
点击文件名下载附件
下载积分: 威望 -5
385.96 KB, 下载次数: 167, 下载积分: 威望 -5
作者:
shen
时间:
2008-11-24 14:22
好东西,给顶顶!
作者:
marshal_li
时间:
2009-3-17 11:30
学习一下
作者:
whzkh
时间:
2009-4-20 20:08
提示:
作者被禁止或删除 内容自动屏蔽
作者:
小混混
时间:
2010-2-13 20:37
黄金!!楼主真阔气!
作者:
woking
时间:
2011-3-16 20:50
牛逼啊,都逛到国外去了!
作者:
slivermichael
时间:
2011-8-10 11:11
大感谢!
欢迎光临 EDA365电子工程师网 (https://bbs.elecnest.cn/)
Powered by Discuz! X3.2