Line 1... |
Line 1... |
-- $Id: pdp11_core_rri.vhd 335 2010-10-24 22:24:23Z mueller $
|
-- $Id: pdp11_core_rbus.vhd 352 2011-01-02 13:01:37Z mueller $
|
--
|
--
|
-- Copyright 2007-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2007-2010 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
--
|
--
|
-- This program is free software; you may redistribute and/or modify it under
|
-- This program is free software; you may redistribute and/or modify it under
|
-- the terms of the GNU General Public License as published by the Free
|
-- the terms of the GNU General Public License as published by the Free
|
Line 10... |
Line 10... |
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
-- for complete details.
|
-- for complete details.
|
--
|
--
|
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
-- Module Name: pdp11_core_rri - syn
|
-- Module Name: pdp11_core_rbus - syn
|
-- Description: pdp11: core to rri register port interface
|
-- Description: pdp11: core to rbus interface
|
--
|
--
|
-- Dependencies: -
|
-- Dependencies: -
|
-- Test bench: tb/tb_rritba_pdp11core
|
-- Test bench: tb/tb_rlink_tba_pdp11core
|
-- tb/tb_rripdp_pdp11core
|
|
-- tb/tb_rriext_pdp11core
|
|
--
|
--
|
-- Target Devices: generic
|
-- Target Devices: generic
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 11.4, 12.1; ghdl 0.18-0.26
|
-- Tool versions: xst 8.1, 8.2, 9.1, 9.2, 11.4, 12.1; ghdl 0.18-0.26
|
-- Revision History: -
|
-- Revision History: -
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2010-12-29 351 1.1 renamed from pdp11_core_rri; ported to rbv3
|
-- 2010-10-23 335 1.2.3 rename RRI_LAM->RB_LAM;
|
-- 2010-10-23 335 1.2.3 rename RRI_LAM->RB_LAM;
|
-- 2010-06-20 308 1.2.2 use c_ibrb_ibf_ def's
|
-- 2010-06-20 308 1.2.2 use c_ibrb_ibf_ def's
|
-- 2010-06-18 306 1.2.1 rename RB_ADDR->RB_ADDR_CORE, add RB_ADDR_IBUS;
|
-- 2010-06-18 306 1.2.1 rename RB_ADDR->RB_ADDR_CORE, add RB_ADDR_IBUS;
|
-- add ibrb register and ibr window logic
|
-- add ibrb register and ibr window logic
|
-- 2010-06-13 305 1.2 add CP_ADDR in port; mostly rewritten for new
|
-- 2010-06-13 305 1.2 add CP_ADDR in port; mostly rewritten for new
|
Line 80... |
Line 79... |
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.rrilib.all;
|
use work.rblib.all;
|
use work.pdp11.all;
|
use work.pdp11.all;
|
|
|
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
|
|
entity pdp11_core_rri is -- core to rri reg port interface
|
entity pdp11_core_rbus is -- core to rbus interface
|
generic (
|
generic (
|
RB_ADDR_CORE : slv8 := conv_std_logic_vector(2#00000000#,8);
|
RB_ADDR_CORE : slv8 := conv_std_logic_vector(2#00000000#,8);
|
RB_ADDR_IBUS : slv8 := conv_std_logic_vector(2#10000000#,8));
|
RB_ADDR_IBUS : slv8 := conv_std_logic_vector(2#10000000#,8));
|
port (
|
port (
|
CLK : in slbit; -- clock
|
CLK : in slbit; -- clock
|
Line 103... |
Line 102... |
CP_ADDR : out cp_addr_type; -- console address port
|
CP_ADDR : out cp_addr_type; -- console address port
|
CP_DIN : out slv16; -- console data in
|
CP_DIN : out slv16; -- console data in
|
CP_STAT : in cp_stat_type; -- console status port
|
CP_STAT : in cp_stat_type; -- console status port
|
CP_DOUT : in slv16 -- console data out
|
CP_DOUT : in slv16 -- console data out
|
);
|
);
|
end pdp11_core_rri;
|
end pdp11_core_rbus;
|
|
|
|
|
architecture syn of pdp11_core_rri is
|
architecture syn of pdp11_core_rbus is
|
|
|
type state_type is (
|
type state_type is (
|
s_idle, -- s_idle: wait for rp access
|
s_idle, -- s_idle: wait for rp access
|
s_cpwait, -- s_cpwait: wait for cp port ack
|
s_cpwait, -- s_cpwait: wait for cp port ack
|
s_cpstep -- s_cpstep: wait for cpustep done
|
s_cpstep -- s_cpstep: wait for cpustep done
|
);
|
);
|
|
|
type regs_type is record
|
type regs_type is record
|
state : state_type; -- state
|
state : state_type; -- state
|
|
rbselc : slbit; -- rbus select for core
|
|
rbseli : slbit; -- rbus select for ibus
|
cpreq : slbit; -- cp request flag
|
cpreq : slbit; -- cp request flag
|
cpfunc : slv5; -- cp function
|
cpfunc : slv5; -- cp function
|
cpugo_1 : slbit; -- prev cycle cpugo
|
cpugo_1 : slbit; -- prev cycle cpugo
|
addr : slv22_1; -- address register
|
addr : slv22_1; -- address register
|
ena_22bit : slbit; -- 22bit enable
|
ena_22bit : slbit; -- 22bit enable
|
Line 131... |
Line 132... |
waitstep : slbit; -- at cmdack: wait for cpu step complete
|
waitstep : slbit; -- at cmdack: wait for cpu step complete
|
end record regs_type;
|
end record regs_type;
|
|
|
constant regs_init : regs_type := (
|
constant regs_init : regs_type := (
|
s_idle, -- state
|
s_idle, -- state
|
|
'0','0', -- rbselc,rbseli
|
'0', -- cpreq
|
'0', -- cpreq
|
(others=>'0'), -- cpfunc
|
(others=>'0'), -- cpfunc
|
'0', -- cpugo_1
|
'0', -- cpugo_1
|
(others=>'0'), -- addr
|
(others=>'0'), -- addr
|
'0','0', -- ena_22bit, ena_ubmap
|
'0','0', -- ena_22bit, ena_ubmap
|
Line 163... |
Line 165... |
proc_next: process (R_REGS, RB_MREQ, CP_STAT, CP_DOUT)
|
proc_next: process (R_REGS, RB_MREQ, CP_STAT, CP_DOUT)
|
|
|
variable r : regs_type := regs_init;
|
variable r : regs_type := regs_init;
|
variable n : regs_type := regs_init;
|
variable n : regs_type := regs_init;
|
|
|
variable irb_selc : slbit := '0';
|
|
variable irb_seli : slbit := '0';
|
|
variable irb_ack : slbit := '0';
|
variable irb_ack : slbit := '0';
|
variable irb_busy : slbit := '0';
|
variable irb_busy : slbit := '0';
|
variable irb_err : slbit := '0';
|
variable irb_err : slbit := '0';
|
variable irb_dout : slv16 := (others=>'0');
|
variable irb_dout : slv16 := (others=>'0');
|
variable irb_lam : slbit := '0';
|
variable irb_lam : slbit := '0';
|
|
variable irbena : slbit := '0';
|
|
|
variable icpreq : slbit := '0';
|
variable icpreq : slbit := '0';
|
variable icpureset : slbit := '0';
|
variable icpureset : slbit := '0';
|
variable icpaddr : cp_addr_type := cp_addr_init;
|
variable icpaddr : cp_addr_type := cp_addr_init;
|
|
|
begin
|
begin
|
|
|
r := R_REGS;
|
r := R_REGS;
|
n := R_REGS;
|
n := R_REGS;
|
|
|
irb_selc := '0';
|
|
irb_seli := '0';
|
|
irb_ack := '0';
|
irb_ack := '0';
|
irb_busy := '0';
|
irb_busy := '0';
|
irb_err := '0';
|
irb_err := '0';
|
irb_dout := (others=>'0');
|
irb_dout := (others=>'0');
|
irb_lam := '0';
|
irb_lam := '0';
|
|
|
|
irbena := RB_MREQ.re or RB_MREQ.we;
|
|
|
icpreq := '0';
|
icpreq := '0';
|
icpureset := '0';
|
icpureset := '0';
|
|
|
if RB_MREQ.req='1' then
|
-- look for init's against the rbus base address, generate subsystem resets
|
|
if RB_MREQ.init='1' and RB_MREQ.we='1' and RB_MREQ.addr=RB_ADDR_CORE then
|
|
icpureset := RB_MREQ.din(0);
|
|
end if;
|
|
|
|
-- rbus address decoder
|
|
n.rbseli := '0';
|
|
n.rbselc := '0';
|
|
if RB_MREQ.aval='1' then
|
if RB_MREQ.addr(7 downto 5)=RB_ADDR_CORE(7 downto 5) then
|
if RB_MREQ.addr(7 downto 5)=RB_ADDR_CORE(7 downto 5) then
|
irb_selc := '1';
|
n.rbselc := '1';
|
irb_ack := '1'; -- ack all, unless reject or busy
|
|
end if;
|
end if;
|
if RB_MREQ.addr(7 downto 5)=RB_ADDR_IBUS(7 downto 5) then
|
if RB_MREQ.addr(7 downto 5)=RB_ADDR_IBUS(7 downto 5) then
|
irb_seli := '1';
|
n.rbseli := '1';
|
irb_ack := '1'; -- ack all, unless reject or busy
|
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- look for init's against the rbus base address, generate subsystem resets
|
if (r.rbselc='1' or r.rbseli='1') and irbena='1' then
|
if RB_MREQ.init='1' and RB_MREQ.we='1' and RB_MREQ.addr=RB_ADDR_CORE then
|
irb_ack := '1'; -- ack all (maybe rejected later)
|
icpureset := RB_MREQ.din(0);
|
|
end if;
|
end if;
|
|
|
case r.state is
|
case r.state is
|
|
|
when s_idle => -- s_idle: wait for rbus access ------
|
when s_idle => -- s_idle: wait for rbus access ------
|
|
|
n.doinc := '0';
|
n.doinc := '0';
|
n.waitstep := '0';
|
n.waitstep := '0';
|
|
|
if irb_seli = '1' then
|
if r.rbseli = '1' then
|
|
if irbena = '1' then
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.cpfunc(0) := RB_MREQ.we;
|
icpreq := '1';
|
icpreq := '1';
|
|
end if;
|
|
|
elsif irb_selc = '1' then
|
elsif r.rbselc = '1' then
|
|
|
case RB_MREQ.addr(4 downto 0) is
|
case RB_MREQ.addr(4 downto 0) is
|
|
|
when c_rbaddr_conf => -- conf -------------------------
|
when c_rbaddr_conf => -- conf -------------------------
|
null; -- currently no action
|
null; -- currently no action
|
|
|
when c_rbaddr_cntl => -- cntl -------------------------
|
when c_rbaddr_cntl => -- cntl -------------------------
|
|
if irbena = '1' then
|
n.cpfunc := RB_MREQ.din(n.cpfunc'range);
|
n.cpfunc := RB_MREQ.din(n.cpfunc'range);
|
|
end if;
|
if RB_MREQ.we = '1' then
|
if RB_MREQ.we = '1' then
|
icpreq := '1';
|
icpreq := '1';
|
if RB_MREQ.din(3 downto 0) = c_cpfunc_step(3 downto 0) then
|
if RB_MREQ.din(3 downto 0) = c_cpfunc_step(3 downto 0) then
|
n.waitstep := '1';
|
n.waitstep := '1';
|
end if;
|
end if;
|
Line 243... |
Line 253... |
irb_dout(c_stat_rbf_cpugo) := CP_STAT.cpugo;
|
irb_dout(c_stat_rbf_cpugo) := CP_STAT.cpugo;
|
irb_dout(c_stat_rbf_cpuhalt) := CP_STAT.cpuhalt;
|
irb_dout(c_stat_rbf_cpuhalt) := CP_STAT.cpuhalt;
|
irb_dout(c_stat_rbf_cpurust) := CP_STAT.cpurust;
|
irb_dout(c_stat_rbf_cpurust) := CP_STAT.cpurust;
|
|
|
when c_rbaddr_psw => -- psw --------------------------
|
when c_rbaddr_psw => -- psw --------------------------
|
|
if irbena = '1' then
|
n.cpfunc := c_cpfunc_rpsw;
|
n.cpfunc := c_cpfunc_rpsw;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.cpfunc(0) := RB_MREQ.we;
|
icpreq := '1';
|
icpreq := '1';
|
|
end if;
|
|
|
when c_rbaddr_al => -- al ---------------------------
|
when c_rbaddr_al => -- al ---------------------------
|
irb_dout(c_al_rbf_addr) := r.addr(c_al_rbf_addr);
|
irb_dout(c_al_rbf_addr) := r.addr(c_al_rbf_addr);
|
if RB_MREQ.we = '1' then
|
if RB_MREQ.we = '1' then
|
n.addr := (others=>'0'); -- write to al clears ah !!
|
n.addr := (others=>'0'); -- write to al clears ah !!
|
Line 267... |
Line 279... |
n.ena_22bit := RB_MREQ.din(c_ah_rbf_ena_22bit);
|
n.ena_22bit := RB_MREQ.din(c_ah_rbf_ena_22bit);
|
n.ena_ubmap := RB_MREQ.din(c_ah_rbf_ena_ubmap);
|
n.ena_ubmap := RB_MREQ.din(c_ah_rbf_ena_ubmap);
|
end if;
|
end if;
|
|
|
when c_rbaddr_mem => -- mem -----------------
|
when c_rbaddr_mem => -- mem -----------------
|
|
if irbena = '1' then
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.cpfunc(0) := RB_MREQ.we;
|
icpreq := '1';
|
icpreq := '1';
|
|
end if;
|
|
|
when c_rbaddr_memi => -- memi ----------------
|
when c_rbaddr_memi => -- memi ----------------
|
|
if irbena = '1' then
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc := c_cpfunc_rmem;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.doinc := '1';
|
n.doinc := '1';
|
icpreq := '1';
|
icpreq := '1';
|
|
end if;
|
|
|
when c_rbaddr_r0 | c_rbaddr_r1 |
|
when c_rbaddr_r0 | c_rbaddr_r1 |
|
c_rbaddr_r2 | c_rbaddr_r3 |
|
c_rbaddr_r2 | c_rbaddr_r3 |
|
c_rbaddr_r4 | c_rbaddr_r5 |
|
c_rbaddr_r4 | c_rbaddr_r5 |
|
c_rbaddr_sp | c_rbaddr_pc => -- r* ------------------
|
c_rbaddr_sp | c_rbaddr_pc => -- r* ------------------
|
|
if irbena = '1' then
|
n.cpfunc := c_cpfunc_rreg;
|
n.cpfunc := c_cpfunc_rreg;
|
n.cpfunc(0) := RB_MREQ.we;
|
n.cpfunc(0) := RB_MREQ.we;
|
icpreq := '1';
|
icpreq := '1';
|
|
end if;
|
|
|
when c_rbaddr_ibrb => -- ibrb ----------------
|
when c_rbaddr_ibrb => -- ibrb ----------------
|
irb_dout(c_ibrb_ibf_base) := r.ibrbase;
|
irb_dout(c_ibrb_ibf_base) := r.ibrbase;
|
irb_dout(c_ibrb_ibf_be) := r.ibrberet;
|
irb_dout(c_ibrb_ibf_be) := r.ibrberet;
|
if RB_MREQ.we = '1' then
|
if RB_MREQ.we = '1' then
|
Line 314... |
Line 332... |
end if;
|
end if;
|
|
|
when s_cpwait => -- s_cpwait: wait for cp port ack ----
|
when s_cpwait => -- s_cpwait: wait for cp port ack ----
|
n.cpreq := '0'; -- cpreq only for 1 cycle
|
n.cpreq := '0'; -- cpreq only for 1 cycle
|
|
|
if (irb_selc or irb_seli) = '0' then -- rbus cycle abort
|
if (r.rbselc or r.rbseli)='0' or irbena='0' then -- rbus cycle abort
|
n.state := s_idle; -- quit
|
n.state := s_idle; -- quit
|
else
|
else
|
irb_dout := CP_DOUT;
|
irb_dout := CP_DOUT;
|
irb_err := CP_STAT.cmderr or CP_STAT.cmdmerr;
|
irb_err := CP_STAT.cmderr or CP_STAT.cmdmerr;
|
if CP_STAT.cmdack = '1' then -- normal cycle end
|
if CP_STAT.cmdack = '1' then -- normal cycle end
|
Line 335... |
Line 353... |
irb_busy := '1';
|
irb_busy := '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
when s_cpstep => -- s_cpstep: wait for cpustep done ---
|
when s_cpstep => -- s_cpstep: wait for cpustep done ---
|
if irb_selc = '0' then -- rbus cycle abort
|
if r.rbselc='0' or irbena='0' then -- rbus cycle abort
|
n.state := s_idle; -- quit
|
n.state := s_idle; -- quit
|
else
|
else
|
if CP_STAT.cpustep = '0' then -- cpustep done
|
if CP_STAT.cpustep = '0' then -- cpustep done
|
n.state := s_idle;
|
n.state := s_idle;
|
else
|
else
|
Line 355... |
Line 373... |
icpaddr.racc := '0';
|
icpaddr.racc := '0';
|
icpaddr.be := "11";
|
icpaddr.be := "11";
|
icpaddr.ena_22bit := r.ena_22bit;
|
icpaddr.ena_22bit := r.ena_22bit;
|
icpaddr.ena_ubmap := r.ena_ubmap;
|
icpaddr.ena_ubmap := r.ena_ubmap;
|
|
|
if irb_seli = '1' then
|
if r.rbseli = '1' and irbena = '1' then
|
icpaddr.addr(15 downto 13) := "111";
|
icpaddr.addr(15 downto 13) := "111";
|
icpaddr.addr(c_ibrb_ibf_base) := r.ibrbase;
|
icpaddr.addr(c_ibrb_ibf_base) := r.ibrbase;
|
icpaddr.addr(5 downto 1) := RB_MREQ.addr(4 downto 0);
|
icpaddr.addr(5 downto 1) := RB_MREQ.addr(4 downto 0);
|
icpaddr.racc := '1';
|
icpaddr.racc := '1';
|
icpaddr.be := r.ibrbe;
|
icpaddr.be := r.ibrbe;
|