📄 ahbahb.vhd
字号:
<font class=menu_section>More</font> </td></tr> <tr><td> <li class=small> <a class=menu_item href="/projects.cgi/web/wishbone/"><font class=menu_item>Wishbone</font></a></li> </td></tr> <tr><td> <li class=small> <a class=menu_item href="/projects.cgi/web/perlilog/"><font class=menu_item>Perlilog</font></a></li> </td></tr> <tr><td> <li class=small> <a class=menu_item href="/projects.cgi/web/edatools/"><font class=menu_item>EDA tools</font></a></li> </td></tr> <tr><td> <li class=small> <a class=menu_item href="/projects.cgi/web/opentech/"><font class=menu_item>OpenTech CD</font></a></li> </td></tr> <tr><td><font size=-2> </font></td></tr> </table></td><td width=10><img width=10 src="/images/dotty.gif"></td><td background="/images/vpd.gif"><img width=1 src="/images/dotty.gif"></td><td width=10><img width=10 src="/images/dotty.gif"></td><td valign=top> <table width=100% cellpadding=2 cellspacing=0 border=0> <tr><td><img height=2 src="/images/dotty.gif"></td></tr> </table> <table width=100% cellspacing=0 cellpadding=0 border=0><tr><td><!-- pf_body_start --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>AHBAHB/ahbahb.vhd - view - 1.1.1.1</title><meta name="robots" content="nofollow" /><meta name="generator" content="FreeBSD-CVSweb 3.0.5" /><meta http-equiv="Content-Script-Type" content="text/javascript" /><meta http-equiv="Content-Style-Type" content="text/css" /><link rel="stylesheet" type="text/css" href="/css/cvsweb.css" /></head><body class="src"><table class="navigate-header" width="100%" summary="Navigation"> <tr> <td><a href="./ahbahb.vhd#rev1.1.1.1"><img src="/icons/back.gif" alt="[BACK]" border="0" width="20" height="22" /></a><b>Return to <a href="./ahbahb.vhd#rev1.1.1.1">ahbahb.vhd</a> CVS log</b> <img src="/icons/text.gif" alt="[TXT]" border="0" width="20" height="22" /></td> <td style="text-align: right"><img src="/icons/dir.gif" alt="[DIR]" border="0" width="20" height="22" /> <b>Up to <a href="/cvsweb.shtml/#dirlist">[Official OpenCores CVS Repository]</a> / <a href="/cvsweb.shtml/AHBAHB/#dirlist">AHBAHB</a></b></td> </tr></table><hr /><div class="log-markup">File: <a href="/cvsweb.shtml/#dirlist">[Official OpenCores CVS Repository]</a> / <a href="/cvsweb.shtml/AHBAHB/#dirlist">AHBAHB</a> / <a href="/cvsweb.shtml/AHBAHB/ahbahb.vhd">ahbahb.vhd</a><br /><a name="rev1.1.1.1"></a><a name="arelease"></a><a name="HEAD"></a> Revision <b>1.1.1.1</b> <i>(vendor branch)</i>: <a href="/cvsweb.cgi/~checkout~/AHBAHB/ahbahb.vhd?rev=1.1.1.1;content-type=text%2Fplain" class="download-link">download</a> - view: <a href="ahbahb.vhd?rev=1.1.1.1;content-type=text%2Fplain" class="display-link">text</a>, <a href="ahbahb.vhd?annotate=1.1.1.1">annotated</a> - <a href="ahbahb.vhd?r1=1.1.1.1#rev1.1.1.1">select for diffs</a><br /><i>Sun Jun 9 09:31:31 2002 UTC</i> (4 years, 11 months ago) by <i>mobileune</i><br />Branches: <a href="./ahbahb.vhd?only_with_tag=avendor">avendor</a>,<a href="./ahbahb.vhd?only_with_tag=MAIN">MAIN</a><br />CVS tags: <a href="./ahbahb.vhd?only_with_tag=arelease">arelease</a>,<a href="./ahbahb.vhd?only_with_tag=HEAD">HEAD</a><br /><pre class="log">no message</pre></div><hr /><pre>------------------------------------------------------------------------------ This library 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 of the License, or (at your option) any later version.---- See the file COPYING.LGPL for the full details of the license.------------------------------------------------------------------------------- -- Entity: ahbahb-- File: ahbahb.vhd-- Author: MobileUne -- Description: AMBA AHB-AHB Bridge (Multiple Slave to Master)------------------------------------------------------------------------------ library IEEE;use IEEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use work.amba.all;entity ahbahb is generic ( slaves : integer := 2 ); port ( resetn : in std_logic; clk : in std_logic; slvi : in ahb_slv_in_vector(slaves-1 downto 0); slvo : out ahb_slv_out_vector(slaves-1 downto 0); msti : in ahb_mst_in_type; msto : out ahb_mst_out_type );end;architecture rtl of ahbahb istype reg_type is record slvi : ahb_slv_in_vector(slaves-1 downto 0); slvo : ahb_slv_out_type; msti : ahb_mst_in_type; msto : ahb_mst_out_type; busgrant : std_logic; control : std_logic; ready : std_logic;end record;signal r, rin : reg_type;begin comb : process(resetn, msti, slvi, r) variable rv : reg_type; variable sl_master : integer; variable sl_muxctrl : integer; variable slvgrant : std_logic_vector(slaves-1 downto 0); variable htrans : std_logic_vector(1 downto 0); begin if resetn/='1' then sl_master:=slaves; end if;-- Slave select arbitration if (msti.hgrant='0') or (r.ready='1') then if ((sl_master/=slaves) and (r.slvi(sl_master).hsel and r.slvi(sl_master).hready)='0') or sl_master=slaves then sl_master := slaves; for i in 0 to slaves-1 loop if r.slvi(i).hsel='1' and r.slvi(i).hready='1' then sl_master := i; end if; end loop; end if; end if; if (msti.hgrant and msti.hready)='1' then rv.busgrant := '1'; --elsif r.msti.hgrant='0' then elsif msti.hgrant='0' then rv.busgrant := '0'; else rv.busgrant := r.busgrant; end if; if r.ready='1' then rv.control := '0'; elsif (rv.msto.hbusreq and msti.hgrant and msti.hready and r.busgrant)='1' then rv.control := '1'; -- elsif msti.hgrant='0' then -- rv.control := '0'; else rv.control := r.control; end if; if (rv.msto.hbusreq and msti.hgrant and msti.hready and r.control)='1' then rv.ready := '1'; else rv.ready := '0'; end if; -- Slave access grant control mux for i in 0 to slaves-1 loop if i=sl_master then slvgrant(i) := rv.control; else slvgrant(i) := '0'; end if; end loop;-- Latch all input AHB slave signals for i in 0 to slaves-1 loop if (slvi(i).hsel = '1' and slvi(i).hready='1') or (slvgrant(i)='1') then rv.slvi(i) := slvi(i); else rv.slvi(i) := r.slvi(i); end if; end loop;-- Bus request if sl_master/=slaves then rv.msto.hbusreq:='1'; else rv.msto.hbusreq:='0'; end if;-- input ahb slave bus mux if sl_master/=slaves then sl_muxctrl:=sl_master; else sl_muxctrl:=0; end if; msto.hbusreq <= r.msto.hbusreq; if r.msto.hbusreq='1' then htrans := r.slvi(sl_muxctrl).htrans; msto.hlock <= '1'; else htrans := "00"; msto.hlock <= '0'; end if; msto.htrans <= htrans; -- msto.htrans <= r.slvi(sl_muxctrl).htrans; msto.haddr <= r.slvi(sl_muxctrl).haddr; msto.hwrite <= r.slvi(sl_muxctrl).hwrite; msto.hsize <= r.slvi(sl_muxctrl).hsize; msto.hburst <= r.slvi(sl_muxctrl).hburst; msto.hprot <= r.slvi(sl_muxctrl).hprot; msto.hwdata <= r.slvi(sl_muxctrl).hwdata; rv.msti.hgrant := msti.hgrant; rv.msti.hready := msti.hready; rv.slvo.hready := rv.ready; rv.slvo.hresp := msti.hresp; rv.slvo.hrdata := msti.hrdata; rv.slvo.hsplit := (others=>'0');-- output ahb slave bus mux for i in 0 to slaves-1 loop slvo(i).hresp <= rv.slvo.hresp; slvo(i).hrdata <= rv.slvo.hrdata; slvo(i).hsplit <= rv.slvo.hsplit; if i=sl_master then --slvo(i).hready <= r.slvo.hready; slvo(i).hready <= rv.slvo.hready;--direct out; timing might be critical else slvo(i).hready <= '0'; end if; end loop; rin <= rv; end process; reg0 : process(resetn,clk) begin if rising_edge(clk) then r <= rin; end if; end process;end;</pre><hr /><address><span style="font-size: smaller">FreeBSD-CVSweb <<a href="mailto:freebsd-cvsweb@FreeBSD.org">freebsd-cvsweb@FreeBSD.org</a>></span></address></body></html><!-- pf_body_end --></td><td><img width=15 src="/images/dotty.gif"></td></tr></table><xcenter><p><table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td align=right valign=bottom><a title='Top' href='#top'><img border=0 alt='Top' src='/images/hr_up.gif'></a></td></tr> <tr><td background='/images/hpd.gif'><img height=1 border=0 src='/images/dotty.gif'></td></tr><tr><td height=4><img height=4 src='/images/dotty.gif'></td></tr></table> <br><!--<table border=0 cellpadding=0 cellspacing=1 bgcolor=#ffffff><tr><td><table cellpadding=0 cellspacing=0 border=0 bgcolor=#ffffff><tr><td>//--><script type="text/javascript"><!--google_ad_client = "pub-9285819221080148";google_alternate_color = "FFFFFF";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_type = "text_image";google_ad_channel ="3034172958";google_color_border = "ffffff";google_color_bg = "ffffff";google_color_link = "444488";google_color_url = "b00000";google_color_text = "666666";//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><!--</td></tr></table></td></tr></table>//--></center><img border=0 src="/images/dotty.gif" height=1 width=400><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30></td></tr></table> </td></tr><tr bgcolor=#000000><td><img height=1 src="/images/dotty.gif"></td></tr></table><table background="/images/topbg.gif" width=100% cellpadding=0 cellspacing=0 border=0 bgcolor=#aaddff><tr><td align=right>Copyright (c) 1999-2007 OPENCORES.ORG. All rights reserved. </td></tr><tr><td> </td></tr></table></td><td width=1 bgcolor=#000000><img width=1 src="/images/dotty.gif"></td><td width=1 bgcolor=#f0f0c8><img width=1 src="/images/dotty.gif"></td></tr></table></center><!-- pf_footer_start --> </body></html><!-- pf_footer_end -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -