WISHBONEの活用


概要

WISHBONEはSystem-on-Chip (SoC) Interconnect Architecture(簡単に言えばパラレル・バスの規格)です。
FPGA等に実装されるSLAVE-DEVICEとCPU等のMASTER-DEVICE間を簡単、且つ、簡潔に接続する事を目指して規格されています。
ライセンスもロイヤルティーも無く、自由に使用出来ます。
WISHBONEは、OPENCORES.ORGにて仕様書(wbspec_b3.pdf)が参照出来ます。
今後のHDL設計にて利用しておくとIP-COREの再利用がし易くなると思いますので、活用したいと思います。


基本接続

以下に基本接続図を示します。

※図は仕様書(wbspec_b3.pdf)の図1-2を引用


sample

以下にSLAVE-DEVICE(16bit長汎用OUTPUT-PORT:8bit長アクセス可能)を示します。


※図は仕様書(wbspec_b3.pdf)の図A-12を引用

file:WBOPRT16.vhd
仕様書のサンプルを自分流の記述スタイルに修正してあります。

--***************************************
--* Title        : WBOPRT16.vhd         *
--* Designer     : Osamu Kawashima      *
--* Created Date : 2007.02.26           *
--* Modified Date: ----.--.--           *
--*                                     *
--*  Copyright Osamu Kawashima          *
--***************************************

library ieee;
use ieee.std_logic_1164.all;

entity WBOPRT16 is
	port (
		-- WISHBONE SLAVE interface:
		WB_CLK_I        : in    std_logic;
		WB_RST_I        : in    std_logic;
		WB_DAT_I        : in    std_logic_vector(15 downto 0);
		WB_WE_I         : in    std_logic;
		WB_SEL_I        : in    std_logic_vector(1 downto 0); 
		WB_STB_I        : in    std_logic;
		WB_ACK_O        : out   std_logic;
		WB_DAT_O        : out   std_logic_vector(15 downto 0);

		-- Output port (non-WISHBONE signals):
		PRT_O           : out   std_logic_vector(15 downto 0)
	);
end WBOPRT16;

architecture RTL of WBOPRT16 is

	constant ZERO32		: std_logic_vector(31 downto 0) := (others=>'0');

	signal	dat_h           : std_logic_vector(7 downto 0);
	signal	dat_l           : std_logic_vector(7 downto 0);

begin

	process(WB_CLK_I)
	begin
		if WB_CLK_I'event and WB_CLK_I='1' then
			if WB_RST_I='1' then
				dat_h <= (others=>'0');
			elsif (WB_STB_I and WB_WE_I and WB_SEL_I(1))='1' then
				dat_h <= WB_DAT_I(15 downto 8);
			else
				dat_h <= dat_h;
			end if;
		end if;

		if WB_CLK_I'event and WB_CLK_I='1' then
			if WB_RST_I='1' then
				dat_l <= (others=>'0');
			elsif (WB_STB_I and WB_WE_I and WB_SEL_I(0))='1' then
				dat_l <= WB_DAT_I(7 downto 0);
			else
				dat_l <= dat_l;
			end if;
		end if;
	end process;

	WB_ACK_O <= WB_STB_I;
	WB_DAT_O(15 downto 8) <= dat_h;
	WB_DAT_O( 7 downto 0) <= dat_l;
	PRT_O(15 downto 8) <= dat_h;
	PRT_O( 7 downto 0) <= dat_l;

end RTL;


History