Commit 26ea7f84 authored by Mathias Kreider's avatar Mathias Kreider

wr_eca: added new eca action channel - programmable wishbone master

WB slave interface auto-generated by wbgenplus
parent feec500b
......@@ -14,4 +14,7 @@ files = [
"eca_wb_channel.vhd",
"eca_wb_event.vhd",
"eca_wr_time.vhd",
"wr_eca.vhd"]
"wr_eca.vhd",
"eca_ac_wbm_auto_pkg.vhd",
"eca_ac_wbm_auto.vhd",
"eca_ac_wbm.vhd"]
#ifndef _ECA_AC_WBM_H_
#define _ECA_AC_WBM_H_
//| Address Map ------------------------ slave ----------------------------------------------|
#define SLAVE_STATUS_GET 0x00 // r _0x000000ff , Shows if the device is rdy/busy
#define SLAVE_MAX_MACROS_GET 0x04 // r _0xffffffff , Shows maximum number of macros
#define SLAVE_MAX_SPACE_GET 0x08 // r _0xffffffff , Shows maximum memory space
#define SLAVE_ENABLE_GET 0x0c // rw _0x00000001 , Turns device on/off
#define SLAVE_ENABLE_SET 0x10 // rw _0x00000001 , ""
#define SLAVE_ENABLE_CLR 0x14 // rw _0x00000001 , ""
#define SLAVE_EXEC_OWR 0x18 // wfs _0x000000ff , Executes macro at idx
#define SLAVE_LAST_EXEC_GET 0x1c // r _0x000000ff , Shows idx of last executed macro
#define SLAVE_REC_OWR 0x20 // wfs _0x000000ff , Records macro at idx
#define SLAVE_LAST_REC_GET 0x24 // r _0x000000ff , Shows idx of last recorded macro
#define SLAVE_MACRO_QTY_GET 0x28 // r _0x000000ff , Shows the number of macros in the ram
#define SLAVE_SPACE_LEFT_GET 0x2c // r _0x0000ffff , Shows number of free spaces in the RAM
#define SLAVE_CLEAR_ALL_OWR 0x30 // wsp _0x00000001 , Clears all macros
#define SLAVE_CLEAR_IDX_OWR 0x34 // wfs _0x000000ff , Clears macro at idx
#define SLAVE_REC_FIFO_OWR 0x38 // wf _0xffffffff , Recording fifo. 3 word sequences: #ADR# #VAL# #META#
#endif
This diff is collapsed.
<wbdevice unitname="eca_ac_wbm" author="M. Kreider" version="0.0.1">
<codegen>
<generate language="vhdl" documentation="yes" test="yes"></generate>
<generate language="c" documentation="yes" test="yes"></generate>
<generate language="c++" documentation="yes" test="yes"></generate>
</codegen>
<generics>
</generics>
<slaveinterface name="slave" data="32" type="pipelined" pages="0">
<sdb vendorID="GSI" productID="0x18415778" version="1" date="auto" name="ECA ActChn WBM"></sdb>
<registers>
<reg name="STATUS" read="yes" mask="0xff" comment="Shows if the device is rdy/busy"></reg>
<reg name="MAX_MACROS" read="yes" mask="0xffffffff" comment="Shows maximum number of macros"></reg>
<reg name="MAX_SPACE" read="yes" mask="0xffffffff" comment="Shows maximum memory space"></reg>
<reg name="ENABLE" read="yes" write="yes" access="atomic" mask="0x1" comment="Turns device on/off"></reg>
<reg name="EXEC" write="yes" mask="0xff" weflag="yes" autostall='yes' comment="Executes macro at idx"></reg>
<reg name="LAST_EXEC" read="yes" mask="0xff" comment="Shows idx of last executed macro"></reg>
<reg name="REC" write="yes" mask="0xff" weflag="yes" autostall='yes' comment="Records macro at idx"></reg>
<reg name="LAST_REC" read="yes" mask="0xff" comment="Shows idx of last recorded macro"></reg>
<reg name="MACRO_QTY" read="yes" mask="0xff" comment="Shows the number of macros in the ram"></reg>
<reg name="SPACE_LEFT" read="yes" mask="0xffff" comment="Shows number of free spaces in the RAM"></reg>
<reg name="CLEAR_ALL" write="yes" mask="0x1" autostall='yes' pulse='yes' comment="Clears all macros"></reg>
<reg name="CLEAR_IDX" write="yes" mask="0xff" weflag="yes" autostall='yes' comment="Clears macro at idx"></reg>
<reg name="REC_FIFO" write="yes" mask="0xffffffff" weflag="yes" comment="Recording fifo. 3 word sequences: #ADR# #VAL# #META#"></reg>
</registers>
</slaveinterface>
</wbdevice>
-- File Name : /home/mkreider/hdlprojects/bel_projects/ip_cores/wr-cores/modules/wr_eca/eca_ac_wbm_auto.vhd
-- Design Unit Name : eca_ac_wbm_auto
-- Revision : 0.0.1
-- Author : M. Kreider
-- Created : 08/01/2015
-- ***********************************************************
-- ** WARNING - THIS IS AUTO-GENERATED CODE! DO NOT MODIFY! **
-- ***********************************************************
--
-- If you want to change the interface,
-- modify eca_ac_wbm.xml and re-run 'python wbgenplus.py eca_ac_wbm.xml' !
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.wishbone_pkg.all;
use work.eca_ac_wbm_auto_pkg.all;
entity eca_ac_wbm_auto is
Port(
clk_sys_i : in std_logic;
rst_n_i : in std_logic;
slave_regs_i : in t_slave_regs_i;
slave_regs_o : out t_slave_regs_o;
slave_i : in t_wishbone_slave_in := ('0', '0', x"00000000", x"F", '0', x"00000000");
slave_o : out t_wishbone_slave_out
);
end eca_ac_wbm_auto;
architecture rtl of eca_ac_wbm_auto is
--+******************************************************************************************+
--| ------------------------------------- WB Registers -------------------------------------|
--+******************************************************************************************+
--| WBS Regs ---------------------------- slave ---------------------------------------------|
signal r_slave : t_slave_regs_o;
signal s_slave : t_slave_regs_i;
signal r_slave_out_stall : std_logic;
signal r_slave_out_ack0,
r_slave_out_ack1,
r_slave_out_err0,
r_slave_out_err1 : std_logic;
signal r_slave_out_dat0,
r_slave_out_dat1 : std_logic_vector(31 downto 0);
begin
--+******************************************************************************************+
--| WBS FSM ------------------------------ slave --------------------------------------------|
--+******************************************************************************************+
slave : process(clk_sys_i)
variable v_dat_i : t_wishbone_data;
variable v_dat_o : t_wishbone_data;
variable v_adr : natural;
variable v_page : natural;
variable v_sel : t_wishbone_byte_select;
variable v_we : std_logic;
variable v_en : std_logic;
begin
if rising_edge(clk_sys_i) then
if(rst_n_i = '0') then
r_slave.ENABLE <= (others => '0');
r_slave.EXEC <= (others => '0');
r_slave.EXEC_WE <= '0'; -- pulse
r_slave.REC <= (others => '0');
r_slave.REC_WE <= '0'; -- pulse
r_slave.CLEAR_ALL <= (others => '0');
r_slave.CLEAR_IDX <= (others => '0');
r_slave.CLEAR_IDX_WE <= '0'; -- pulse
r_slave.REC_FIFO <= (others => '0');
r_slave.REC_FIFO_WE <= '0'; -- pulse
r_slave_out_stall <= '0';
r_slave_out_ack0 <= '0';
r_slave_out_err0 <= '0';
r_slave_out_dat0 <= (others => '0');
r_slave_out_ack1 <= '0';
r_slave_out_err1 <= '0';
r_slave_out_dat1 <= (others => '0');
else
-- short names
v_dat_i := slave_i.dat;
v_adr := to_integer(unsigned(slave_i.adr(5 downto 2)) & "00");
v_sel := slave_i.sel;
v_en := slave_i.cyc and slave_i.stb and not (r_slave_out_stall or slave_regs_i.STALL);
v_we := slave_i.we;
--interface outputs
r_slave_out_stall <= '0';
r_slave_out_ack0 <= '0';
r_slave_out_err0 <= '0';
r_slave_out_dat0 <= (others => '0');
r_slave_out_ack1 <= r_slave_out_ack0;
r_slave_out_err1 <= r_slave_out_err0;
r_slave_out_dat1 <= r_slave_out_dat0;
r_slave.EXEC_WE <= '0'; -- EXEC pulse
r_slave.REC_WE <= '0'; -- REC pulse
r_slave.CLEAR_ALL <= (others => '0'); -- CLEAR_ALL pulse
r_slave.CLEAR_IDX_WE <= '0'; -- CLEAR_IDX pulse
r_slave.REC_FIFO_WE <= '0'; -- REC_FIFO pulse
if(v_en = '1') then
r_slave_out_ack0 <= '1';
if(v_we = '1') then
-- WISHBONE WRITE ACTIONS
case v_adr is
when c_slave_ENABLE_SET => r_slave.ENABLE <= f_wb_wr(r_slave.ENABLE, v_dat_i, v_sel, "set"); -- Turns device on/off
when c_slave_ENABLE_CLR => r_slave.ENABLE <= f_wb_wr(r_slave.ENABLE, v_dat_i, v_sel, "clr"); -- ""
when c_slave_EXEC_OWR => r_slave.EXEC <= f_wb_wr(r_slave.EXEC, v_dat_i, v_sel, "owr"); -- Executes macro at idx
r_slave.EXEC_WE <= '1'; -- EXEC write enable
r_slave_out_stall <= '1'; -- EXEC auto stall
when c_slave_REC_OWR => r_slave.REC <= f_wb_wr(r_slave.REC, v_dat_i, v_sel, "owr"); -- Records macro at idx
r_slave.REC_WE <= '1'; -- REC write enable
r_slave_out_stall <= '1'; -- REC auto stall
when c_slave_CLEAR_ALL_OWR => r_slave.CLEAR_ALL <= f_wb_wr(r_slave.CLEAR_ALL, v_dat_i, v_sel, "owr"); -- Clears all macros
r_slave_out_stall <= '1'; -- CLEAR_ALL auto stall
when c_slave_CLEAR_IDX_OWR => r_slave.CLEAR_IDX <= f_wb_wr(r_slave.CLEAR_IDX, v_dat_i, v_sel, "owr"); -- Clears macro at idx
r_slave.CLEAR_IDX_WE <= '1'; -- CLEAR_IDX write enable
r_slave_out_stall <= '1'; -- CLEAR_IDX auto stall
when c_slave_REC_FIFO_OWR => r_slave.REC_FIFO <= f_wb_wr(r_slave.REC_FIFO, v_dat_i, v_sel, "owr"); -- Recording fifo. 3 word sequences: #ADR# #VAL# #META#
r_slave.REC_FIFO_WE <= '1'; -- REC_FIFO write enable
when others => r_slave_out_ack0 <= '0'; r_slave_out_err0 <= '1';
end case;
else
-- WISHBONE READ ACTIONS
case v_adr is
when c_slave_STATUS_GET => r_slave_out_dat0(7 downto 0) <= s_slave.STATUS; -- Shows if the device is rdy/busy
when c_slave_MAX_MACROS_GET => r_slave_out_dat0(31 downto 0) <= s_slave.MAX_MACROS; -- Shows maximum number of macros
when c_slave_MAX_SPACE_GET => r_slave_out_dat0(31 downto 0) <= s_slave.MAX_SPACE; -- Shows maximum memory space
when c_slave_ENABLE_GET => r_slave_out_dat0(0 downto 0) <= r_slave.ENABLE; -- Turns device on/off
when c_slave_LAST_EXEC_GET => r_slave_out_dat0(7 downto 0) <= s_slave.LAST_EXEC; -- Shows idx of last executed macro
when c_slave_LAST_REC_GET => r_slave_out_dat0(7 downto 0) <= s_slave.LAST_REC; -- Shows idx of last recorded macro
when c_slave_MACRO_QTY_GET => r_slave_out_dat0(7 downto 0) <= s_slave.MACRO_QTY; -- Shows the number of macros in the ram
when c_slave_SPACE_LEFT_GET => r_slave_out_dat0(15 downto 0) <= s_slave.SPACE_LEFT; -- Shows number of free spaces in the RAM
when others => r_slave_out_ack0 <= '0'; r_slave_out_err0 <= '1';
end case;
end if; -- v_we
end if; -- v_en
end if; -- rst
end if; -- clk edge
end process;
slave_regs_o <= r_slave;
s_slave <= slave_regs_i;
slave_o.stall <= r_slave_out_stall or slave_regs_i.STALL;
slave_o.dat <= r_slave_out_dat1;
slave_o.ack <= r_slave_out_ack1 and not slave_regs_i.ERR;
slave_o.err <= r_slave_out_err1 or slave_regs_i.ERR;
end rtl;
-- File Name : /home/mkreider/hdlprojects/bel_projects/ip_cores/wr-cores/modules/wr_eca/eca_ac_wbm_auto_pkg.vhd
-- Design Unit Name : eca_ac_wbm_auto
-- Revision : 0.0.1
-- Author : M. Kreider
-- Created : 08/01/2015
-- ***********************************************************
-- ** WARNING - THIS IS AUTO-GENERATED CODE! DO NOT MODIFY! **
-- ***********************************************************
--
-- If you want to change the interface,
-- modify eca_ac_wbm.xml and re-run 'python wbgenplus.py eca_ac_wbm.xml' !
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.wishbone_pkg.all;
package eca_ac_wbm_auto_pkg is
--+******************************************************************************************+
--| ------------------------------- WB Slaves - Adress Maps --------------------------------|
--+******************************************************************************************+
--| WBS Adr ------------------------------ slave --------------------------------------------|
constant c_slave_STATUS_GET : natural := 16#00#; -- r 0x000000ff, Shows if the device is rdy/busy
constant c_slave_MAX_MACROS_GET : natural := 16#04#; -- r 0xffffffff, Shows maximum number of macros
constant c_slave_MAX_SPACE_GET : natural := 16#08#; -- r 0xffffffff, Shows maximum memory space
constant c_slave_ENABLE_GET : natural := 16#0c#; -- rw 0x00000001, Turns device on/off
constant c_slave_ENABLE_SET : natural := 16#10#; -- rw 0x00000001, ""
constant c_slave_ENABLE_CLR : natural := 16#14#; -- rw 0x00000001, ""
constant c_slave_EXEC_OWR : natural := 16#18#; -- wfs 0x000000ff, Executes macro at idx
constant c_slave_LAST_EXEC_GET : natural := 16#1c#; -- r 0x000000ff, Shows idx of last executed macro
constant c_slave_REC_OWR : natural := 16#20#; -- wfs 0x000000ff, Records macro at idx
constant c_slave_LAST_REC_GET : natural := 16#24#; -- r 0x000000ff, Shows idx of last recorded macro
constant c_slave_MACRO_QTY_GET : natural := 16#28#; -- r 0x000000ff, Shows the number of macros in the ram
constant c_slave_SPACE_LEFT_GET : natural := 16#2c#; -- r 0x0000ffff, Shows number of free spaces in the RAM
constant c_slave_CLEAR_ALL_OWR : natural := 16#30#; -- wsp 0x00000001, Clears all macros
constant c_slave_CLEAR_IDX_OWR : natural := 16#34#; -- wfs 0x000000ff, Clears macro at idx
constant c_slave_REC_FIFO_OWR : natural := 16#38#; -- wf 0xffffffff, Recording fifo. 3 word sequences: #ADR# #VAL# #META#
--+******************************************************************************************+
--| ------------------------- WB Slaves - Control Register Records -------------------------|
--+******************************************************************************************+
--| WBS Register Record ------------ slave --------------------------------------------------|
type t_slave_regs_o is record
ENABLE : std_logic_vector(0 downto 0); -- Turns device on/off
EXEC : std_logic_vector(7 downto 0); -- Executes macro at idx
EXEC_WE : std_logic; -- WE flag
REC : std_logic_vector(7 downto 0); -- Records macro at idx
REC_WE : std_logic; -- WE flag
CLEAR_ALL : std_logic_vector(0 downto 0); -- Clears all macros
CLEAR_IDX : std_logic_vector(7 downto 0); -- Clears macro at idx
CLEAR_IDX_WE : std_logic; -- WE flag
REC_FIFO : std_logic_vector(31 downto 0); -- Recording fifo. 3 word sequences: #ADR# #VAL# #META#
REC_FIFO_WE : std_logic; -- WE flag
end record t_slave_regs_o;
type t_slave_regs_i is record
STALL : std_logic; -- Stall control for outside entity
ERR : std_logic; -- Error control for outside entity
STATUS : std_logic_vector(7 downto 0); -- Shows if the device is rdy/busy
MAX_MACROS : std_logic_vector(31 downto 0); -- Shows maximum number of macros
MAX_SPACE : std_logic_vector(31 downto 0); -- Shows maximum memory space
LAST_EXEC : std_logic_vector(7 downto 0); -- Shows idx of last executed macro
LAST_REC : std_logic_vector(7 downto 0); -- Shows idx of last recorded macro
MACRO_QTY : std_logic_vector(7 downto 0); -- Shows the number of macros in the ram
SPACE_LEFT : std_logic_vector(15 downto 0); -- Shows number of free spaces in the RAM
end record t_slave_regs_i;
--| Component ---------------------- eca_ac_wbm_auto ----------------------------------------|
component eca_ac_wbm_auto is
Port(
clk_sys_i : in std_logic;
rst_n_i : in std_logic;
slave_regs_i : in t_slave_regs_i;
slave_regs_o : out t_slave_regs_o;
slave_i : in t_wishbone_slave_in := ('0', '0', x"00000000", x"F", '0', x"00000000");
slave_o : out t_wishbone_slave_out
);
end component;
constant c_eca_ac_wbm_slave_sdb : t_sdb_device := (
abi_class => x"0000", -- undocumented device
abi_ver_major => x"01",
abi_ver_minor => x"00",
wbd_endian => c_sdb_endian_big,
wbd_width => x"7", -- 8/16/32-bit port granularity
sdb_component => (
addr_first => x"0000000000000000",
addr_last => x"000000000000003f",
product => (
vendor_id => x"0000000000000651",
device_id => x"18415778",
version => x"00000001",
date => x"20150108",
name => "ECA ACTCHN WBM ")));
end eca_ac_wbm_auto_pkg;
package body eca_ac_wbm_auto_pkg is
end eca_ac_wbm_auto_pkg;
......@@ -27,9 +27,16 @@ use ieee.numeric_std.all;
library work;
use work.wishbone_pkg.all;
use work.eca_ac_wbm_auto_pkg.c_eca_ac_wbm_slave_sdb;
package eca_pkg is
constant c_eca_ac_wbm_slave_sdb : t_sdb_device := work.eca_ac_wbm_auto_pkg.c_eca_ac_wbm_slave_sdb;
constant c_eca_sdb : t_sdb_device := (
abi_class => x"0000", -- undocumented device
abi_ver_major => x"02",
......@@ -245,6 +252,26 @@ package eca_pkg is
tag : out std_logic_vector(31 downto 0));
end component eca_scubus_channel;
-- uses channel tag to replay specified bus ops macro on wishbone master
component eca_ac_wbm
generic(
g_entries : natural := 32;
g_ram_size : natural := 256
);
Port(
clk_ref_i : in std_logic;
rst_ref_n_i : in std_logic;
channel_i : in t_channel;
clk_sys_i : in std_logic;
rst_sys_n_i : in std_logic;
slave_i : in t_wishbone_slave_in := ('0', '0', x"00000000", x"F", '0', x"00000000");
slave_o : out t_wishbone_slave_out;
master_o : out t_wishbone_master_out;
master_i : in t_wishbone_master_in
);
end component;
---------------------- Internals ------------------------
function f_eca_active_high(x : boolean) return std_logic;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment