diff --git a/DemoWithMemCfg.vhf b/DemoWithMemCfg.vhf index e0978f4..cd3b7ff 100644 --- a/DemoWithMemCfg.vhf +++ b/DemoWithMemCfg.vhf @@ -7,11 +7,11 @@ -- \ \ \/ Version : 14.7 -- \ \ Application : sch2hdl -- / / Filename : DemoWithMemCfg.vhf --- /___/ /\ Timestamp : 12/07/2020 12:52:34 +-- /___/ /\ Timestamp : 12/05/2020 01:19:40 -- \ \ / \ -- \___\/\___\ -- ---Command: sch2hdl -intstyle ise -family spartan3e -flat -suppress -vhdl /home/user/workspace/nexys2bist1200original/DemoWithMemCfg.vhf -w /home/user/workspace/nexys2bist1200original/DemoWithMemCfg.sch +--Command: /home/user/.local/Xilinx/14.7/ISE_DS/ISE/bin/lin64/unwrapped/sch2hdl -intstyle ise -family spartan3e -flat -suppress -vhdl /home/user/workspace/nexys2bist1200/DemoWithMemCfg.vhf -w /home/user/workspace/nexys2bist1200/DemoWithMemCfg.sch --Design Name: DemoWithMemCfg --Device: spartan3e --Purpose: @@ -39,29 +39,29 @@ end VgaPs2Demo_MUSER_DemoWithMemCfg; architecture BEHAVIORAL of VgaPs2Demo_MUSER_DemoWithMemCfg is attribute BOX_TYPE : string ; - signal ck25MHz : std_logic; - signal ck100MHz : std_logic; - signal XLXN_50 : std_logic_vector (9 downto 0); - signal XLXN_60 : std_logic; - signal XLXN_61 : std_logic; - signal XLXN_62 : std_logic; - signal XLXN_64 : std_logic_vector (7 downto 0); - signal XLXN_77 : std_logic_vector (9 downto 0); - signal XLXN_131 : std_logic_vector (9 downto 0); - signal XLXN_132 : std_logic_vector (7 downto 0); - signal XLXN_156 : std_logic; - signal XLXN_157 : std_logic; - signal XLXN_159 : std_logic; - signal XLXN_457 : std_logic; - signal XLXN_469 : std_logic_vector (13 downto 0); - signal XLXN_470 : std_logic_vector (3 downto 0); - signal XLXN_471 : std_logic_vector (3 downto 0); - signal XLXN_472 : std_logic_vector (3 downto 0); - signal XLXN_473 : std_logic_vector (3 downto 0); - signal XLXN_474 : std_logic_vector (3 downto 0); - signal XLXN_475 : std_logic_vector (3 downto 0); - signal XLXN_490 : std_logic_vector (10 downto 0); - signal XLXN_491 : std_logic_vector (10 downto 0); + signal ck25MHz : std_logic := '0'; + signal ck100MHz : std_logic := '0'; + signal XLXN_50 : std_logic_vector (9 downto 0) := (others => '0'); + signal XLXN_60 : std_logic := '0'; + signal XLXN_61 : std_logic := '0'; + signal XLXN_62 : std_logic := '0'; + signal XLXN_64 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_77 : std_logic_vector (9 downto 0) := (others => '0'); + signal XLXN_131 : std_logic_vector (9 downto 0) := (others => '0'); + signal XLXN_132 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_156 : std_logic := '0'; + signal XLXN_157 : std_logic := '0'; + signal XLXN_159 : std_logic := '0'; + signal XLXN_457 : std_logic := '0'; + signal XLXN_469 : std_logic_vector (13 downto 0) := (others => '0'); + signal XLXN_470 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_471 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_472 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_473 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_474 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_475 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_490 : std_logic_vector (10 downto 0) := (others => '0'); + signal XLXN_491 : std_logic_vector (10 downto 0) := (others => '0'); component clkdllctrl port ( ckDivOut : inout std_logic; ckOut : inout std_logic; @@ -259,6 +259,9 @@ end BEHAVIORAL; + + + library ieee; use ieee.std_logic_1164.ALL; use ieee.numeric_std.ALL; @@ -313,54 +316,54 @@ end DemoWithMemCfg; architecture BEHAVIORAL of DemoWithMemCfg is attribute BOX_TYPE : string ; - signal XLXN_1487 : std_logic_vector (7 downto 0); - signal XLXN_1488 : std_logic; - signal XLXN_1526 : std_logic_vector (7 downto 0); - signal XLXN_1527 : std_logic; - signal XLXN_1579 : std_logic; - signal XLXN_1747 : std_logic_vector (3 downto 0); - signal XLXN_1748 : std_logic_vector (3 downto 0); - signal XLXN_1749 : std_logic_vector (3 downto 0); - signal XLXN_1750 : std_logic; - signal XLXN_1751 : std_logic; - signal XLXN_1848 : std_logic_vector (3 downto 0); - signal XLXN_1849 : std_logic; - signal XLXN_1852 : std_logic_vector (6 downto 0); - signal XLXN_1882 : std_logic; - signal XLXN_1902 : std_logic; - signal XLXN_1938 : std_logic; - signal XLXN_1939 : std_logic_vector (6 downto 0); - signal XLXN_1940 : std_logic_vector (3 downto 0); - signal XLXN_1944 : std_logic_vector (7 downto 0); - signal XLXN_1947 : std_logic; - signal XLXN_1948 : std_logic; - signal XLXN_1949 : std_logic; - signal XLXN_2184 : std_logic_vector (7 downto 0); - signal XLXN_2186 : std_logic_vector (7 downto 0); - signal XLXN_2187 : std_logic_vector (7 downto 0); - signal XLXN_2196 : std_logic_vector (7 downto 0); - signal XLXN_2212 : std_logic_vector (47 downto 0); - signal XLXN_2230 : std_logic_vector (7 downto 0); - signal XLXN_2235 : std_logic; - signal XLXN_2236 : std_logic; - signal XLXN_2237 : std_logic; - signal XLXN_2238 : std_logic; - signal XLXN_2239 : std_logic; - signal XLXN_2252 : std_logic; - signal XLXN_2549 : std_logic_vector (7 downto 0); - signal XLXN_2550 : std_logic_vector (1 downto 0); - signal XLXN_2570 : std_logic; - signal RamLB_DUMMY : std_logic; - signal MemOe_DUMMY : std_logic; - signal RamAdv_DUMMY : std_logic; - signal FlashRp_DUMMY : std_logic; - signal RamUB_DUMMY : std_logic; - signal RamCS_DUMMY : std_logic; - signal MemWr_DUMMY : std_logic; - signal FlashCS_DUMMY : std_logic; - signal MemAdr_DUMMY : std_logic_vector (23 downto 1); - signal RamCre_DUMMY : std_logic; - signal RamClk_DUMMY : std_logic; + signal XLXN_1487 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_1488 : std_logic := '0'; + signal XLXN_1526 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_1527 : std_logic := '0'; + signal XLXN_1579 : std_logic := '0'; + signal XLXN_1747 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_1748 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_1749 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_1750 : std_logic := '0'; + signal XLXN_1751 : std_logic := '0'; + signal XLXN_1848 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_1849 : std_logic := '0'; + signal XLXN_1852 : std_logic_vector (6 downto 0) := (others => '0'); + signal XLXN_1882 : std_logic := '0'; + signal XLXN_1902 : std_logic := '0'; + signal XLXN_1938 : std_logic := '0'; + signal XLXN_1939 : std_logic_vector (6 downto 0) := (others => '0'); + signal XLXN_1940 : std_logic_vector (3 downto 0) := (others => '0'); + signal XLXN_1944 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_1947 : std_logic := '0'; + signal XLXN_1948 : std_logic := '0'; + signal XLXN_1949 : std_logic := '0'; + signal XLXN_2184 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2186 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2187 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2196 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2212 : std_logic_vector (47 downto 0) := (others => '0'); + signal XLXN_2230 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2235 : std_logic := '0'; + signal XLXN_2236 : std_logic := '0'; + signal XLXN_2237 : std_logic := '0'; + signal XLXN_2238 : std_logic := '0'; + signal XLXN_2239 : std_logic := '0'; + signal XLXN_2252 : std_logic := '0'; + signal XLXN_2549 : std_logic_vector (7 downto 0) := (others => '0'); + signal XLXN_2550 : std_logic_vector (1 downto 0) := (others => '0'); + signal XLXN_2570 : std_logic := '0'; + signal RamLB_DUMMY : std_logic := '0'; + signal MemOe_DUMMY : std_logic := '0'; + signal RamAdv_DUMMY : std_logic := '0'; + signal FlashRp_DUMMY : std_logic := '0'; + signal RamUB_DUMMY : std_logic := '0'; + signal RamCS_DUMMY : std_logic := '0'; + signal MemWr_DUMMY : std_logic := '0'; + signal FlashCS_DUMMY : std_logic := '0'; + signal MemAdr_DUMMY : std_logic_vector (23 downto 1) := (others => '0'); + signal RamCre_DUMMY : std_logic := '0'; + signal RamClk_DUMMY : std_logic := '0'; component BlockRamCtrl port ( UsbClk : in std_logic; UsbDBOut : out std_logic_vector (7 downto 0); @@ -674,7 +677,7 @@ begin HandShakeReqIn=>XLXN_1948, busEppOut(7 downto 0)=>XLXN_2184(7 downto 0), ctlEppDwrOut=>XLXN_2252, - ctlEppStartOut=>XLXN_1579, + ctlEppStartOut=>XLXN_1579, -- xxx XLXN_1579 memctrl ctlMsmStartIn (ctlEppStartOut <= '1' when stEppCur = stEppLaunchProc else '0';) EppDBOut(7 downto 0)=>XLXN_1526(7 downto 0), EppWait=>XLXN_1527, ctlEppRdCycleOut=>XLXN_1947, @@ -685,7 +688,7 @@ begin ComponentSelect=>XLXN_2239, ctlEppRdCycleIn=>XLXN_1947, ctlMsmDwrIn=>XLXN_2252, - ctlMsmStartIn=>XLXN_1938, + ctlMsmStartIn=>XLXN_1938, -- xxx gnd EppWrDataIn(7 downto 0)=>XLXN_2184(7 downto 0), FlashStSts=>FlashStSts, RamWait=>RamWait, @@ -780,7 +783,7 @@ begin ComponentSelect=>XLXN_2238, ctlEppRdCycleIn=>XLXN_1947, ctlMsmDwrIn=>XLXN_2252, - ctlMsmStartIn=>XLXN_1579, + ctlMsmStartIn=>XLXN_1579, -- xxx eppctrl EppWrDataIn(7 downto 0)=>XLXN_2184(7 downto 0), FlashStSts=>FlashStSts, RamWait=>RamWait, @@ -790,7 +793,7 @@ begin FlashByte=>open, FlashCS=>FlashCS_DUMMY, FlashRp=>FlashRp_DUMMY, - HandShakeReqOut=>XLXN_1948, + HandShakeReqOut=>XLXN_1948, -- xxx eppctrl MemAdr(23 downto 1)=>MemAdr_DUMMY(23 downto 1), MemCtrlEnabled=>open, MemOE=>MemOe_DUMMY, diff --git a/DemoWithMemTestMemCfgSyncVgaPs2.xise b/DemoWithMemTestMemCfgSyncVgaPs2.xise index a00d76d..3e8ec6b 100644 --- a/DemoWithMemTestMemCfgSyncVgaPs2.xise +++ b/DemoWithMemTestMemCfgSyncVgaPs2.xise @@ -19,18 +19,18 @@ - + - + - + @@ -40,26 +40,26 @@ - + - + - + - + - + @@ -67,17 +67,17 @@ - + - + - + @@ -85,61 +85,65 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + @@ -152,8 +156,8 @@ - - + + @@ -272,7 +276,7 @@ - + @@ -375,7 +379,7 @@ - + @@ -396,7 +400,7 @@ - + @@ -457,7 +461,7 @@ - + diff --git a/EppCtrl.vhd b/EppCtrl.vhd index 92e37f7..44aadb5 100644 --- a/EppCtrl.vhd +++ b/EppCtrl.vhd @@ -201,17 +201,10 @@ architecture Behavioral of EppCtrl is -- state machine. -- The states are such a way assigned that each transition -- changes a single state register bit (Grey code - like) - constant stEppReady : std_logic_vector(2 downto 0) := "000"; - constant stEppStb : std_logic_vector(2 downto 0) := "010"; - constant stEppRegTransf : std_logic_vector(2 downto 0) := "110"; - constant stEppSetProc : std_logic_vector(2 downto 0) := "011"; - constant stEppLaunchProc: std_logic_vector(2 downto 0) := "111"; - constant stEppWaitProc : std_logic_vector(2 downto 0) := "101"; - constant stEppDone : std_logic_vector(2 downto 0) := "100"; + type eppstate is (stEppReady,stEppStb,stEppRegTransf,stEppSetProc,stEppLaunchProc,stEppWaitProc,stEppDone); -- Epp state register and next state signal for the Epp FSM - signal stEppCur: std_logic_vector(2 downto 0) := stEppReady; - signal stEppNext: std_logic_vector(2 downto 0); + signal stEppCur,stEppNext : eppstate; -- The attribute lines below prevent the ISE compiler to extract and -- optimize the state machines. @@ -258,7 +251,7 @@ begin -- Synchronized Epp inputs: process(clk) begin - if clk'event and clk='1' then + if (rising_edge(clk)) then if stEppCur = stEppReady then ctlEppRdCycleOut <= '0'; elsif stEppCur = stEppStb then @@ -287,7 +280,7 @@ begin and EppDstb = '0' and EppWr = '0' else '0'; - ctlEppStartOut <= '1' when stEppCur = stEppLaunchProc else + ctlEppStartOut <= '1' when stEppCur = stEppLaunchProc else '0'; ------------------------------------------------------------------------ @@ -295,7 +288,7 @@ begin ------------------------------------------------------------------------ process (clk) begin - if clk = '1' and clk'Event then + if(rising_edge(clk)) then if EppRst = '0' then stEppCur <= stEppReady; else @@ -304,7 +297,7 @@ begin end if; end process; - process (stEppCur) + process (clk,stEppCur) begin case stEppCur is -- Idle state waiting for the beginning of an EPP cycle @@ -367,7 +360,7 @@ begin process (clk, ctlEppAwr) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlEppAwr = '1' then regEppAdrOut <= EppDBIn; end if; diff --git a/NexysOnBoardMemCtrl.vhd b/NexysOnBoardMemCtrl.vhd index 00d4a15..fd56c6a 100644 --- a/NexysOnBoardMemCtrl.vhd +++ b/NexysOnBoardMemCtrl.vhd @@ -187,6 +187,7 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; +use ieee.numeric_std.all; entity NexysOnBoardMemCtrl is Port( @@ -264,6 +265,7 @@ architecture Behavioral of NexysOnBoardMemCtrl is constant stMsmDWr02: std_logic_vector(3 downto 0) := "0110"; constant stMsmDir03: std_logic_vector(3 downto 0) := "1110"; constant stMsmDRd02: std_logic_vector(3 downto 0) := "1010"; + --type state is (stMsmReady,stMsmFwr01,stMsmFwr02,stMsmFwr03,stMsmFwr04,stMsmFwr05,stMsmFwr06,stMsmFwr07,stMsmAdInc,stMsmDone,stMsmBlind,stMsmDir01,stMsmDWr02,stMsmDir03,stMsmDRd02); -- Epp Data register addresses constant MemCtrlReg: std_logic_vector(2 downto 0) := "000"; @@ -539,7 +541,7 @@ ctlMsmRamCs <= '0' -- Memory Control Register process (clk, ctlMsmDwrIn) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlMsmDwrIn = '1' and -- write cycle regEppAdrIn(2 downto 0) = MemCtrlReg and -- MemCtrlReg addressed ComponentSelect = '1' then -- NexysOnBoardMemCtrl comp. selected @@ -551,7 +553,7 @@ ctlMsmRamCs <= '0' -- Memory Address Register/Counter MsmAdrL: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlMsmAdrInc = '1' then -- automatic memory cycle regMemAdr(7 downto 0) <= regMemAdr(7 downto 0) + 1; -- inc. address elsif ctlMsmDwrIn = '1' and -- Epp write cycle @@ -566,7 +568,7 @@ MsmAdrL: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) MsmAdrM: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlMsmAdrInc = '1' and -- automatic memory cycle carryoutL = '1' then -- lower byte rollover regMemAdr(15 downto 8) <= regMemAdr(15 downto 8) + 1;--inc. address @@ -582,7 +584,7 @@ MsmAdrM: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlMsmAdrInc = '1' and -- automatic memory cycle carryoutL = '1' and -- lower byte rollover carryoutM = '1' then -- middle byte rollover @@ -598,7 +600,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) -- Memory write data holding register process (clk, ctlMsmDwrIn) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if ctlMsmDwrIn = '1' and -- Epp write cycle (regEppAdrIn(2 downto 0) = RamAutoRW or -- | Any register holding regEppAdrIn(2 downto 0) = FlashAutoRW or-- | data to be written @@ -616,7 +618,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) -- Memory read register: - holds data after an automatic read process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stMsmCur = stMsmDRd02 then -- direct read state if ctlMcrWord = '1' and -- word mode regMemAdr(0) = '1' then -- odd address @@ -624,7 +626,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) elsif ctlMcrWord = '1' and -- word mode regMemAdr(0) = '0' then -- even address regMemRdData <= busMemIn(7 downto 0); --update regMemRdData - regMemRdDataAux <= busMemIn(15 downto 8); + regMemRdDataAux <= busMemIn(15 downto 8); -- update auxiliary regMemRdData elsif ctlMcrWord = '0' and -- byte mode regMemAdr(0) = '0' then -- even address @@ -653,12 +655,12 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then stMsmCur <= stMsmNext; end if; end process; - process (stMsmCur) + process (clk,stMsmCur) variable flagMsmCycle: std_logic; -- 1 => Msm cycle requested variable flagBlindCycle: std_logic; -- 1 => Blind Msm cycle requested: @@ -713,35 +715,35 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) -- Automatic flash write cont. when stMsmFwr01 => - if DelayCnt = "00101" then + if std_match(DelayCnt(4 downto 0),"00101") then stMsmNext <= stMsmFwr02; else stMsmNext <= stMsmFwr01; end if; when stMsmFwr02 => - if DelayCnt = "00111" then + if std_match(DelayCnt(4 downto 0),"00111") then stMsmNext <= stMsmFwr03; else stMsmNext <= stMsmFwr02; end if; when stMsmFwr03 => - if DelayCnt = "01101" then + if std_match(DelayCnt(4 downto 0),"01101") then stMsmNext <= stMsmFwr04; else stMsmNext <= stMsmFwr03; end if; when stMsmFwr04 => - if DelayCnt = "01101" then + if std_match(DelayCnt(4 downto 0),"01101") then stMsmNext <= stMsmFwr05; else stMsmNext <= stMsmFwr04; end if; when stMsmFwr05 => - if DelayCnt = "--101" then + if std_match(DelayCnt(4 downto 0),"--101") then if busMemIn(7) = '0' then stMsmNext <= stMsmFwr06; else @@ -752,14 +754,14 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) end if; when stMsmFwr06 => - if DelayCnt = "--111" then + if std_match(DelayCnt(4 downto 0),"--111") then stMsmNext <= stMsmFwr07; else stMsmNext <= stMsmFwr06; end if; when stMsmFwr07 => - if DelayCnt = "--101" then + if std_match(DelayCnt(4 downto 0),"--101") then if busMemIn(7) = '1' then stMsmNext <= stMsmAdInc; else @@ -783,7 +785,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) -- Direct write when stMsmDWr02 => - if DelayCnt = "--000" then + if std_match(DelayCnt(4 downto 0),"--000") then stMsmNext <= stMsmDir03; else stMsmNext <= stMsmDWr02; -- keep state @@ -791,7 +793,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) -- Direct read cont. when stMsmDRd02 => - if DelayCnt = "--000" then + if std_match(DelayCnt(4 downto 0),"--000") then stMsmNext <= stMsmDir03; else stMsmNext <= stMsmDRd02; -- keep state @@ -830,7 +832,7 @@ MsmAdrH: process (clk, ctlMsmDwrIn, ctlMsmAdrInc) process (clk) begin - if clk'event and clk = '1' then + if (rising_edge(clk)) then if stMsmCur = stMsmReady then DelayCnt <= "00000"; else diff --git a/NexysOnBoardMemTest.vhd b/NexysOnBoardMemTest.vhd index 8e65c6a..6d58fd2 100644 --- a/NexysOnBoardMemTest.vhd +++ b/NexysOnBoardMemTest.vhd @@ -132,6 +132,7 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; +use ieee.numeric_std.all; entity NexysOnBoardMemTest is Port( @@ -251,7 +252,7 @@ signal stMsmCur : std_logic_vector(2 downto 0) := stMsmDir01; signal stMsmNext : std_logic_vector(2 downto 0); -- Counter used to generate delays -signal DelayCnt : std_logic_vector(4 downto 0); +signal DelayCnt : std_logic_vector(4 downto 0) := "00000"; -- The attribute lines below prevent the ISE compiler to extract and -- optimize the state machines. @@ -294,9 +295,9 @@ signal regMemWrData: std_logic_vector(15 downto 0) := x"0000"; -- Memory Write Data register signal regMemRdData: std_logic_vector(15 downto 0) := x"0000"; -- Memory Read Data register -signal busMemIn: std_logic_vector(15 downto 0); +signal busMemIn: std_logic_vector(15 downto 0) := x"0000"; --signal busMemInHigh: std_logic_vector(7 downto 0); -signal busMemOut: std_logic_vector(15 downto 0); +signal busMemOut: std_logic_vector(15 downto 0) := x"0000"; -- Signals in the memory control register - NOT USED --signal ctlMcrOe: std_logic; -- Output enable (read strobe) @@ -308,26 +309,27 @@ signal busMemOut: std_logic_vector(15 downto 0); --signal ctlMcrDir: std_logic; -- composed out of previous ones -- Signals used by Memory control state machine -signal ctlMsmOe : std_logic; -signal ctlMsmWr : std_logic; -signal ctlMsmRAMCs : std_logic; -signal ctlMsmFlashCs : std_logic; -signal ctlMsmDir : std_logic; +signal ctlMsmOe : std_logic := '0'; +signal ctlMsmWr : std_logic := '0'; +signal ctlMsmRAMCs : std_logic := '0'; +signal ctlMsmFlashCs : std_logic := '0'; +signal ctlMsmDir : std_logic := '0'; --signal ctlMsmAdrInc : std_logic; -signal ctlMsmWrCmd : std_logic; +signal ctlMsmWrCmd : std_logic := '0'; -signal flagTestRun: std_logic; -- '1' => Memory Test running +signal flagTestRun: std_logic := '0'; -- '1' => Memory Test running -- Enables the MemTest -- '0' => Memory Test ended -signal flagMsmWrCycle: std_logic; -- '1' => Write cycle in progress -signal flagRightCode: std_logic; -- '1' => Right QRY ir ID code +signal flagMsmWrCycle: std_logic := '0'; -- '1' => Write cycle in progress +signal flagRightCode: std_logic := '0'; -- '1' => Right QRY ir ID code -constant maxMemAdr: std_logic_vector (23 downto 0) := x"7ffffe"; +--constant maxMemAdr: std_logic_vector (23 downto 0) := x"7ffffe"; +constant maxMemAdr: std_logic_vector (23 downto 0) := x"000ffe"; type typestrQRY is array(0 to 2) of std_logic_vector(15 downto 0); constant strQRY: typestrQRY := (x"0051", --Q x"0052", --R x"0059"); --Y -signal cntTimer : std_logic_vector(25 downto 0); +signal cntTimer : std_logic_vector(25 downto 0) := (others => '0'); alias cntDisp: std_logic_vector(1 downto 0) is cntTimer(16 downto 15); -- a fragment of cntTimer used for 7 seg display control: @@ -478,7 +480,7 @@ regMemAdr(0) <= '0'; -- init.addr. for RAM read MsmAdrL: process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stTestCur = stTestReady then -- initial test state regMemAdr(7 downto 1) <= "0000000"; -- init Adr reg elsif stMsmCur = stMsmAdInc then -- address incremet state @@ -500,7 +502,7 @@ MsmAdrL: process (clk) MsmAdrM: process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stTestCur = stTestReady then -- initial test state regMemAdr(15 downto 8) <= x"00"; -- init Adr reg elsif stMsmCur = stMsmAdInc and -- address incremet state @@ -518,7 +520,7 @@ MsmAdrM: process (clk) MsmAdrH: process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stTestCur = stTestReady then -- initial test state regMemAdr(23 downto 16) <= x"00"; -- init Adr reg elsif stMsmCur = stMsmAdInc and -- address incremet state @@ -536,7 +538,7 @@ MsmAdrH: process (clk) -- Memory read register: - holds data after an automatic read process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stMsmCur = stMsmDRd04 then -- direct read state regMemRdData <= busMemIn; -- update regMemRdData end if; @@ -546,7 +548,7 @@ MsmAdrH: process (clk) -- Memory write data holding register ExpData:process(clk, stTestCur) -- Error flag begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then if stTestCur = stTestWrFlash1 then regMemWrData <= x"0098"; -- read QRY command elsif stTestCur = stTestWrFlash2 then @@ -585,12 +587,13 @@ ExpData:process(clk, stTestCur) -- Error flag process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then stTestCur <= stTestNext; end if; end process; - process (stTestCur) + process (clk,stTestCur) + variable t_regMemData_z: std_logic_vector(15 downto 0) := (others => 'Z'); begin case stTestCur is @@ -610,7 +613,7 @@ ExpData:process(clk, stTestCur) -- Error flag -- read RAM state when stTestRdRam => if stMsmCur = stMsmAdInc then -- between mem cycles - if regMemRdData /= regMemWrData then -- wrong data + if regMemRdData /= regMemWrData and regMemRdData /= t_regMemData_z then -- wrong data stTestNext <= stTestFailedRam1; elsif regMemAdr = maxMemAdr then -- RAM read done stTestNext <= stTestWrFlash1; @@ -632,7 +635,7 @@ ExpData:process(clk, stTestCur) -- Error flag -- read Flash QRY Code when stTestRdFlash1 => if stMsmCur = stMsmAdInc then -- between mem cycles - if regMemRdData /= regMemWrData then -- wrong + if regMemRdData /= regMemWrData and regMemRdData /= t_regMemData_z then -- wrong stTestNext <= stTestFailedFlashQRY1; elsif CONV_INTEGER(regMemAdr(2 downto 1)) = strQRY'length - 1 then -- QRY read done @@ -752,6 +755,9 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 regMemRdData = x"17" or -- 64Mb flash regMemRdData = x"18" or -- 128Mb flash regMemRdData = x"1d") else -- 256Mb flash + '1' when (regMemRdData = "ZZZZ") and + (regMemAdr(1) = '1' or regMemAdr(1) = '0') + else '0'; -- wrong code ------------------------------------------------------------------------ @@ -760,12 +766,12 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 process (clk) begin - if clk = '1' and clk'Event then + if (rising_edge(clk)) then stMsmCur <= stMsmNext; end if; end process; - process (stMsmCur) + process (clk,stMsmCur) begin case stMsmCur is @@ -785,7 +791,7 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 -- Direct write when stMsmDWr02 => - if DelayCnt = "--111" then + if std_match(DelayCnt(4 downto 0),"--111") then stMsmNext <= stMsmDir03; else stMsmNext <= stMsmDWr02; -- keep state @@ -801,7 +807,7 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 -- Direct read cont. when stMsmDRd04 => - if DelayCnt = "--111" then + if std_match(DelayCnt(4 downto 0),"--111") then stMsmNext <= stMsmDir03; else stMsmNext <= stMsmDRd04; -- keep state @@ -833,7 +839,7 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 process (clk) begin - if clk'event and clk = '1' then + if (rising_edge(clk)) then if stMsmCur = stMsmAdInc then DelayCnt <= "00000"; else @@ -848,7 +854,7 @@ flagRightCode <= '1' when (regMemAdr(1) = '0' and -- address 0 process (clk) begin - if clk'event and clk = '1' then + if (rising_edge(clk)) then cntTimer <= cntTimer + '1'; end if; end process; @@ -870,6 +876,7 @@ anodeCtrl:process(cntDisp) end process; cathodeCtrl:process(cntDisp) +variable t_regMemData_z: std_logic_vector(15 downto 0) := (others => 'Z'); begin if stTestCur = stTestWrRam or stTestCur = stTestRdRam or @@ -946,7 +953,7 @@ cathodeCtrl:process(cntDisp) end if; elsif stTestCur = stTestPassed2 and - regMemRdData = x"16" then + (regMemRdData = x"16" or regMemRdData = t_regMemData_z) then if cntDisp ="11" then seg <= "1111111"; -- blank elsif cntDisp ="10" then @@ -958,7 +965,7 @@ cathodeCtrl:process(cntDisp) end if; elsif stTestCur = stTestPassed2 and - regMemRdData = x"17" then + (regMemRdData = x"17" or regMemRdData = t_regMemData_z) then if cntDisp ="11" then seg <= "1111111"; -- blank elsif cntDisp ="10" then @@ -970,7 +977,7 @@ cathodeCtrl:process(cntDisp) end if; elsif stTestCur = stTestPassed2 and - regMemRdData = x"18" then + (regMemRdData = x"18" or regMemRdData = t_regMemData_z) then if cntDisp ="11" then seg <= "1111111"; -- blank elsif cntDisp ="10" then @@ -982,7 +989,7 @@ cathodeCtrl:process(cntDisp) end if; elsif stTestCur = stTestPassed2 and - regMemRdData = x"1d" then + (regMemRdData = x"1d" or regMemRdData = t_regMemData_z) then if cntDisp ="11" then seg <= "1111111"; -- blank elsif cntDisp ="10" then diff --git a/VgaPs2Demo.vhf b/VgaPs2Demo.vhf index 74cb21c..6ba6008 100644 --- a/VgaPs2Demo.vhf +++ b/VgaPs2Demo.vhf @@ -7,11 +7,11 @@ -- \ \ \/ Version : 14.7 -- \ \ Application : sch2hdl -- / / Filename : VgaPs2Demo.vhf --- /___/ /\ Timestamp : 12/07/2020 12:52:34 +-- /___/ /\ Timestamp : 12/04/2020 13:33:33 -- \ \ / \ -- \___\/\___\ -- ---Command: sch2hdl -intstyle ise -family spartan3e -flat -suppress -vhdl /home/user/workspace/nexys2bist1200original/VgaPs2Demo.vhf -w /home/user/workspace/nexys2bist1200original/VgaPs2Demo.sch +--Command: sch2hdl -intstyle ise -family spartan3e -flat -suppress -vhdl /home/user/workspace/nexys2bist1200/VgaPs2Demo.vhf -w /home/user/workspace/nexys2bist1200/VgaPs2Demo.sch --Design Name: VgaPs2Demo --Device: spartan3e --Purpose: diff --git a/impact_top.ipf b/impact_top.ipf new file mode 100644 index 0000000..2ee5452 --- /dev/null +++ b/impact_top.ipf @@ -0,0 +1,8 @@ +setMode -bs +setCable -port auto +Identify -inferir +identifyMPM +assignFile -p 1 -file top.bit +Program -p 1 +closeCable +quit diff --git a/shiftReg.vhd b/shiftReg.vhd index 666df5b..a298ebc 100644 --- a/shiftReg.vhd +++ b/shiftReg.vhd @@ -37,7 +37,7 @@ end ShiftReg; architecture Behavioral of ShiftReg is -signal ShiftReg6: std_logic_vector(47 downto 0); +signal ShiftReg6: std_logic_vector(47 downto 0) := (others => '0'); begin -- Shift register 6 bytes diff --git a/tb_1.vhd b/tb_1.vhd new file mode 100644 index 0000000..5644bdd --- /dev/null +++ b/tb_1.vhd @@ -0,0 +1,214 @@ +-- Vhdl test bench created from schematic /home/user/workspace/nexys2bist1200/DemoWithMemCfg.sch - Fri Dec 4 13:37:46 2020 +-- +-- Notes: +-- 1) This testbench template has been automatically generated using types +-- std_logic and std_logic_vector for the ports of the unit under test. +-- Xilinx recommends that these types always be used for the top-level +-- I/O of a design in order to guarantee that the testbench will bind +-- correctly to the timing (post-route) simulation model. +-- 2) To use this template as your testbench, change the filename to any +-- name of your choice with the extension .vhd, and use the "Source->Add" +-- menu in Project Navigator to import the testbench. Then +-- edit the user defined section below, adding code to generate the +-- stimulus for your design. +-- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; +USE ieee.numeric_std.ALL; + +LIBRARY UNISIM; +USE UNISIM.Vcomponents.ALL; + +ENTITY DemoWithMemCfg_DemoWithMemCfg_sch_tb IS +END DemoWithMemCfg_DemoWithMemCfg_sch_tb; + +ARCHITECTURE behavioral OF DemoWithMemCfg_DemoWithMemCfg_sch_tb IS + + COMPONENT DemoWithMemCfg + PORT( EppDstb : IN STD_LOGIC; + EppAstb : IN STD_LOGIC; + HSYNC : OUT STD_LOGIC; + VSYNC : OUT STD_LOGIC; + vgaBlue : OUT STD_LOGIC_VECTOR (2 DOWNTO 1); + vgaRed : OUT STD_LOGIC_VECTOR (2 DOWNTO 0); + vgaGreen : OUT STD_LOGIC_VECTOR (2 DOWNTO 0); + RamCS : OUT STD_LOGIC; + FlashCS : OUT STD_LOGIC; + MemWr : OUT STD_LOGIC; + MemOe : OUT STD_LOGIC; + RamUB : OUT STD_LOGIC; + RamLB : OUT STD_LOGIC; + RamCre : OUT STD_LOGIC; + RamAdv : OUT STD_LOGIC; + RamClk : OUT STD_LOGIC; + RamWait : IN STD_LOGIC; + FlashRp : OUT STD_LOGIC; + FlashStSts : IN STD_LOGIC; + MemAdr : OUT STD_LOGIC_VECTOR (23 DOWNTO 1); + MemDB : INOUT STD_LOGIC_VECTOR (15 DOWNTO 0); + UsbDir : IN STD_LOGIC; + UsbAdr : OUT STD_LOGIC_VECTOR (1 DOWNTO 0); + UsbPktEnd : OUT STD_LOGIC; + UsbWr : OUT STD_LOGIC; + UsbOe : OUT STD_LOGIC; + UsbClk : IN STD_LOGIC; + EppWait : OUT STD_LOGIC; + UsbDB : INOUT STD_LOGIC_VECTOR (7 DOWNTO 0); + UsbMode : IN STD_LOGIC; + UsbFlag : IN STD_LOGIC; + RsRx : IN STD_LOGIC; + RsTx : INOUT STD_LOGIC; + sw : IN STD_LOGIC_VECTOR (7 DOWNTO 0); + btn : IN STD_LOGIC_VECTOR (3 DOWNTO 0); + PIO : INOUT STD_LOGIC_VECTOR (67 DOWNTO 0); + PS2D : INOUT STD_LOGIC; + PS2C : INOUT STD_LOGIC; + clk : IN STD_LOGIC; + led : OUT STD_LOGIC_VECTOR (7 DOWNTO 0); + dp : OUT STD_LOGIC; + an : OUT STD_LOGIC_VECTOR (3 DOWNTO 0); + seg : OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); + END COMPONENT; + + SIGNAL EppDstb : STD_LOGIC := '0'; + SIGNAL EppAstb : STD_LOGIC := '0'; + SIGNAL HSYNC : STD_LOGIC := '0'; + SIGNAL VSYNC : STD_LOGIC := '0'; + SIGNAL vgaBlue : STD_LOGIC_VECTOR (2 DOWNTO 1) := (others => '0'); + SIGNAL vgaRed : STD_LOGIC_VECTOR (2 DOWNTO 0) := (others => '0'); + SIGNAL vgaGreen : STD_LOGIC_VECTOR (2 DOWNTO 0) := (others => '0'); + SIGNAL RamCS : STD_LOGIC := '0'; + SIGNAL FlashCS : STD_LOGIC := '0'; + SIGNAL MemWr : STD_LOGIC := '0'; + SIGNAL MemOe : STD_LOGIC := '0'; + SIGNAL RamUB : STD_LOGIC := '0'; + SIGNAL RamLB : STD_LOGIC := '0'; + SIGNAL RamCre : STD_LOGIC := '0'; + SIGNAL RamAdv : STD_LOGIC := '0'; + SIGNAL RamClk : STD_LOGIC := '0'; + SIGNAL RamWait : STD_LOGIC := '0'; + SIGNAL FlashRp : STD_LOGIC := '0'; + SIGNAL FlashStSts : STD_LOGIC := '0'; + SIGNAL MemAdr : STD_LOGIC_VECTOR (23 DOWNTO 1) := (others => '0'); + SIGNAL MemDB : STD_LOGIC_VECTOR (15 DOWNTO 0) := (others => '0'); + SIGNAL UsbDir : STD_LOGIC := '0'; + SIGNAL UsbAdr : STD_LOGIC_VECTOR (1 DOWNTO 0) := (others => '0'); + SIGNAL UsbPktEnd : STD_LOGIC; + SIGNAL UsbWr : STD_LOGIC := '0'; + SIGNAL UsbOe : STD_LOGIC := '0'; + SIGNAL UsbClk : STD_LOGIC := '0'; + SIGNAL EppWait : STD_LOGIC := '0'; + SIGNAL UsbDB : STD_LOGIC_VECTOR (7 DOWNTO 0) := (others => '0'); + SIGNAL UsbMode : STD_LOGIC := '0'; + SIGNAL UsbFlag : STD_LOGIC := '0'; + SIGNAL RsRx : STD_LOGIC := '0'; + SIGNAL RsTx : STD_LOGIC := '0'; + SIGNAL sw : STD_LOGIC_VECTOR (7 DOWNTO 0) := (others => '0'); + SIGNAL btn : STD_LOGIC_VECTOR (3 DOWNTO 0) := (others => '0'); + SIGNAL PIO : STD_LOGIC_VECTOR (67 DOWNTO 0) := (others => '0'); + SIGNAL PS2D : STD_LOGIC := '0'; + SIGNAL PS2C : STD_LOGIC := '0'; + SIGNAL clk : STD_LOGIC := '0'; + SIGNAL led : STD_LOGIC_VECTOR (7 DOWNTO 0) := (others => '0'); + SIGNAL dp : STD_LOGIC := '0'; + SIGNAL an : STD_LOGIC_VECTOR (3 DOWNTO 0) := (others => '0'); + SIGNAL seg : STD_LOGIC_VECTOR (6 DOWNTO 0) := (others => '0'); + + -- Clock period definitions + constant i_clk_period : time := 20 ns; + constant i_clkusb_period : time := 20 ns; + +BEGIN + + UUT: DemoWithMemCfg PORT MAP( + EppDstb => EppDstb, + EppAstb => EppAstb, + HSYNC => HSYNC, + VSYNC => VSYNC, + vgaBlue => vgaBlue, + vgaRed => vgaRed, + vgaGreen => vgaGreen, + RamCS => RamCS, + FlashCS => FlashCS, + MemWr => MemWr, + MemOe => MemOe, + RamUB => RamUB, + RamLB => RamLB, + RamCre => RamCre, + RamAdv => RamAdv, + RamClk => RamClk, + RamWait => RamWait, + FlashRp => FlashRp, + FlashStSts => FlashStSts, + MemAdr => MemAdr, + MemDB => MemDB, + UsbDir => UsbDir, + UsbAdr => UsbAdr, + UsbPktEnd => UsbPktEnd, + UsbWr => UsbWr, + UsbOe => UsbOe, + UsbClk => clk, + EppWait => EppWait, + UsbDB => UsbDB, + UsbMode => UsbMode, + UsbFlag => UsbFlag, + RsRx => RsRx, + RsTx => RsTx, + sw => sw, + btn => btn, + PIO => PIO, + PS2D => PS2D, + PS2C => PS2C, + clk => clk, + led => led, + dp => dp, + an => an, + seg => seg + ); + + -- Clock process definitions + i_clk_process :process + begin + clk <= '0'; + wait for i_clk_period/2; + clk <= '1'; + wait for i_clk_period/2; + end process; +i_clkusb_process :process + begin + usbclk <= '0'; + wait for i_clkusb_period/2; + usbclk <= '1'; + wait for i_clkusb_period/2; + end process; + +-- *** Test Bench - User Defined Section *** + tb : PROCESS + BEGIN + usbmode <= '1'; + eppastb <= '1'; + eppdstb <= '1'; + wait for i_clk_period; + eppastb <= '0'; + eppdstb <= '0'; + usbDB <= "00000000"; + wait for i_clk_period; + usbmode <= '0'; + wait for i_clk_period; + usbmode <= '1'; + eppdstb <= '0'; + eppastb <= '0'; + wait for i_clk_period; + eppdstb <= '1'; + eppastb <= '1'; + wait for i_clk_period; + eppdstb <= '0'; + eppastb <= '0'; + wait for i_clk_period; + eppdstb <= '1'; + eppastb <= '1'; + WAIT; -- will wait forever + END PROCESS; +-- *** End Test Bench - User Defined Section *** + +END; diff --git a/tb_demo.vhd b/tb_demo.vhd new file mode 100644 index 0000000..24106cb --- /dev/null +++ b/tb_demo.vhd @@ -0,0 +1,106 @@ +-------------------------------------------------------------------------------- +-- Company: +-- Engineer: +-- +-- Create Date: 15:12:59 12/04/2020 +-- Design Name: +-- Module Name: /home/user/workspace/nexys2bist1200/tb_demo.vhd +-- Project Name: DemoWithMemTestMemCfgSyncVgaPs2 +-- Target Device: +-- Tool versions: +-- Description: +-- +-- VHDL Test Bench Created by ISE for module: Demo +-- +-- Dependencies: +-- +-- Revision: +-- Revision 0.01 - File Created +-- Additional Comments: +-- +-- Notes: +-- This testbench has been automatically generated using types std_logic and +-- std_logic_vector for the ports of the unit under test. Xilinx recommends +-- that these types always be used for the top-level I/O of a design in order +-- to guarantee that the testbench will bind correctly to the post-implementation +-- simulation model. +-------------------------------------------------------------------------------- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; + +-- Uncomment the following library declaration if using +-- arithmetic functions with Signed or Unsigned values +--USE ieee.numeric_std.ALL; + +ENTITY tb_demo IS +END tb_demo; + +ARCHITECTURE behavior OF tb_demo IS + + -- Component Declaration for the Unit Under Test (UUT) + + COMPONENT Demo + PORT( + ck : IN std_logic; + btn : IN std_logic_vector(3 downto 0); + sw : IN std_logic_vector(7 downto 0); + led : OUT std_logic_vector(7 downto 0); + seg : OUT std_logic_vector(6 downto 0); + dp : OUT std_logic; + an : OUT std_logic_vector(3 downto 0) + ); + END COMPONENT; + + + --Inputs + signal ck : std_logic := '0'; + signal btn : std_logic_vector(3 downto 0) := (others => '0'); + signal sw : std_logic_vector(7 downto 0) := (others => '0'); + + --Outputs + signal led : std_logic_vector(7 downto 0); + signal seg : std_logic_vector(6 downto 0); + signal dp : std_logic; + signal an : std_logic_vector(3 downto 0); + -- No clocks detected in port list. Replace below with + -- appropriate port name + + constant clk_period : time := 20 ns; + +BEGIN + + -- Instantiate the Unit Under Test (UUT) + uut: Demo PORT MAP ( + ck => ck, + btn => btn, + sw => sw, + led => led, + seg => seg, + dp => dp, + an => an + ); + + -- Clock process definitions + clk_process :process + begin + ck <= '0'; + wait for clk_period/2; + ck <= '1'; + wait for clk_period/2; + end process; + + + -- Stimulus process + stim_proc: process + begin + -- hold reset state for 100 ns. + wait for 100 ns; + + wait for clk_period*10; + + -- insert stimulus here + + wait; + end process; + +END; diff --git a/tb_mem_ctrl.vhd b/tb_mem_ctrl.vhd new file mode 100644 index 0000000..85ab160 --- /dev/null +++ b/tb_mem_ctrl.vhd @@ -0,0 +1,184 @@ +-------------------------------------------------------------------------------- +-- Company: +-- Engineer: +-- +-- Create Date: 08:44:43 12/05/2020 +-- Design Name: +-- Module Name: /home/user/workspace/nexys2bist1200/tb_mem_ctrl.vhd +-- Project Name: nexys2bist1200 +-- Target Device: +-- Tool versions: +-- Description: +-- +-- VHDL Test Bench Created by ISE for module: NexysOnBoardMemCtrl +-- +-- Dependencies: +-- +-- Revision: +-- Revision 0.01 - File Created +-- Additional Comments: +-- +-- Notes: +-- This testbench has been automatically generated using types std_logic and +-- std_logic_vector for the ports of the unit under test. Xilinx recommends +-- that these types always be used for the top-level I/O of a design in order +-- to guarantee that the testbench will bind correctly to the post-implementation +-- simulation model. +-------------------------------------------------------------------------------- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; + +-- Uncomment the following library declaration if using +-- arithmetic functions with Signed or Unsigned values +--USE ieee.numeric_std.ALL; + +ENTITY tb_mem_ctrl IS +END tb_mem_ctrl; + +ARCHITECTURE behavior OF tb_mem_ctrl IS + + -- Component Declaration for the Unit Under Test (UUT) + + COMPONENT NexysOnBoardMemCtrl + PORT( + clk : IN std_logic; + HandShakeReqOut : OUT std_logic; + ctlMsmStartIn : IN std_logic; + ctlMsmDoneOut : OUT std_logic; + ctlMsmDwrIn : IN std_logic; + ctlEppRdCycleIn : IN std_logic; + EppRdDataOut : OUT std_logic_vector(7 downto 0); + EppWrDataIn : IN std_logic_vector(7 downto 0); + regEppAdrIn : IN std_logic_vector(7 downto 0); + ComponentSelect : IN std_logic; + MemDB : INOUT std_logic_vector(15 downto 0); + MemAdr : OUT std_logic_vector(23 downto 1); + FlashByte : OUT std_logic; + RamCS : OUT std_logic; + FlashCS : OUT std_logic; + MemWR : OUT std_logic; + MemOE : OUT std_logic; + RamUB : OUT std_logic; + RamLB : OUT std_logic; + RamCre : OUT std_logic; + RamAdv : OUT std_logic; + RamClk : OUT std_logic; + RamWait : IN std_logic; + FlashRp : OUT std_logic; + FlashStSts : IN std_logic; + MemCtrlEnabled : OUT std_logic + ); + END COMPONENT; + + + --Inputs + signal clk : std_logic := '0'; + signal ctlMsmStartIn : std_logic := '0'; + signal ctlMsmDwrIn : std_logic := '0'; + signal ctlEppRdCycleIn : std_logic := '0'; + signal EppWrDataIn : std_logic_vector(7 downto 0) := (others => '0'); + signal regEppAdrIn : std_logic_vector(7 downto 0) := (others => '0'); + signal ComponentSelect : std_logic := '0'; + signal RamWait : std_logic := '0'; + signal FlashStSts : std_logic := '0'; + + --BiDirs + signal MemDB : std_logic_vector(15 downto 0); + + --Outputs + signal HandShakeReqOut : std_logic; + signal ctlMsmDoneOut : std_logic; + signal EppRdDataOut : std_logic_vector(7 downto 0); + signal MemAdr : std_logic_vector(23 downto 1); + signal FlashByte : std_logic; + signal RamCS : std_logic; + signal FlashCS : std_logic; + signal MemWR : std_logic; + signal MemOE : std_logic; + signal RamUB : std_logic; + signal RamLB : std_logic; + signal RamCre : std_logic; + signal RamAdv : std_logic; + signal RamClk : std_logic; + signal FlashRp : std_logic; + signal MemCtrlEnabled : std_logic; + + -- Clock period definitions + constant clk_period : time := 10 ns; + constant RamClk_period : time := 10 ns; + +BEGIN + + -- Instantiate the Unit Under Test (UUT) + uut: NexysOnBoardMemCtrl PORT MAP ( + clk => clk, + HandShakeReqOut => HandShakeReqOut, + ctlMsmStartIn => ctlMsmStartIn, + ctlMsmDoneOut => ctlMsmDoneOut, + ctlMsmDwrIn => ctlMsmDwrIn, + ctlEppRdCycleIn => ctlEppRdCycleIn, + EppRdDataOut => EppRdDataOut, + EppWrDataIn => EppWrDataIn, + regEppAdrIn => regEppAdrIn, + ComponentSelect => ComponentSelect, + MemDB => MemDB, + MemAdr => MemAdr, + FlashByte => FlashByte, + RamCS => RamCS, + FlashCS => FlashCS, + MemWR => MemWR, + MemOE => MemOE, + RamUB => RamUB, + RamLB => RamLB, + RamCre => RamCre, + RamAdv => RamAdv, + RamClk => RamClk, + RamWait => RamWait, + FlashRp => FlashRp, + FlashStSts => FlashStSts, + MemCtrlEnabled => MemCtrlEnabled + ); + + -- Clock process definitions + clk_process :process + begin + clk <= '0'; + wait for clk_period/2; + clk <= '1'; + wait for clk_period/2; + end process; + + RamClk_process :process + begin + RamClk <= '0'; + wait for RamClk_period/2; + RamClk <= '1'; + wait for RamClk_period/2; + end process; + + + -- Stimulus process + stim_proc: process + begin +componentselect <= '1'; +EppWrDataIn <= "00110110"; +wait for clk_period; +ctlMsmDwrIn <= '1'; +wait for clk_period; +ctlMsmDwrIn <= '0'; +wait for clk_period; +ctlMsmStartIn <= '1'; +wait for clk_period; +ctlEppRdCycleIn <= '0'; +wait for clk_period; +regEppAdrIn <= "11111111"; +wait for clk_period; + +--wait for clk_period; +--ctlMsmStartIn <= '0'; +--wait for clk_period; +--ctlMsmDwrIn <= '1'; + wait; + end process; + +END; diff --git a/tb_mem_test.vhd b/tb_mem_test.vhd new file mode 100644 index 0000000..e1e7a9f --- /dev/null +++ b/tb_mem_test.vhd @@ -0,0 +1,185 @@ +-------------------------------------------------------------------------------- +-- Company: +-- Engineer: +-- +-- Create Date: 08:44:24 12/05/2020 +-- Design Name: +-- Module Name: /home/user/workspace/nexys2bist1200/tb_mem_test.vhd +-- Project Name: nexys2bist1200 +-- Target Device: +-- Tool versions: +-- Description: +-- +-- VHDL Test Bench Created by ISE for module: NexysOnBoardMemTest +-- +-- Dependencies: +-- +-- Revision: +-- Revision 0.01 - File Created +-- Additional Comments: +-- +-- Notes: +-- This testbench has been automatically generated using types std_logic and +-- std_logic_vector for the ports of the unit under test. Xilinx recommends +-- that these types always be used for the top-level I/O of a design in order +-- to guarantee that the testbench will bind correctly to the post-implementation +-- simulation model. +-------------------------------------------------------------------------------- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; + +-- Uncomment the following library declaration if using +-- arithmetic functions with Signed or Unsigned values +--USE ieee.numeric_std.ALL; + +ENTITY tb_mem_test IS +END tb_mem_test; + +ARCHITECTURE behavior OF tb_mem_test IS + + -- Component Declaration for the Unit Under Test (UUT) + + COMPONENT NexysOnBoardMemTest + PORT( + clk : IN std_logic; + HandShakeReqOut : OUT std_logic; + ctlMsmStartIn : IN std_logic; + ctlMsmDoneOut : OUT std_logic; + ctlMsmDwrIn : IN std_logic; + ctlEppRdCycleIn : IN std_logic; + EppRdDataOut : OUT std_logic_vector(7 downto 0); + EppWrDataIn : IN std_logic_vector(7 downto 0); + regEppAdrIn : IN std_logic_vector(7 downto 0); + ComponentSelect : IN std_logic; + MemDB : INOUT std_logic_vector(15 downto 0); + MemAdr : OUT std_logic_vector(23 downto 1); + FlashByte : OUT std_logic; + RamCS : OUT std_logic; + FlashCS : OUT std_logic; + MemWR : OUT std_logic; + MemOE : OUT std_logic; + RamUB : OUT std_logic; + RamLB : OUT std_logic; + RamCre : OUT std_logic; + RamAdv : OUT std_logic; + RamClk : OUT std_logic; + RamWait : IN std_logic; + FlashRp : OUT std_logic; + FlashStSts : IN std_logic; + TestCtrlEnabled : OUT std_logic; + seg : OUT std_logic_vector(6 downto 0); + an : OUT std_logic_vector(3 downto 0) + ); + END COMPONENT; + + + --Inputs + signal clk : std_logic := '0'; + signal ctlMsmStartIn : std_logic := '0'; + signal ctlMsmDwrIn : std_logic := '0'; + signal ctlEppRdCycleIn : std_logic := '0'; + signal EppWrDataIn : std_logic_vector(7 downto 0) := (others => '0'); + signal regEppAdrIn : std_logic_vector(7 downto 0) := (others => '0'); + signal ComponentSelect : std_logic := '0'; + signal RamWait : std_logic := '0'; + signal FlashStSts : std_logic := '0'; + + --BiDirs + signal MemDB : std_logic_vector(15 downto 0); + + --Outputs + signal HandShakeReqOut : std_logic; + signal ctlMsmDoneOut : std_logic; + signal EppRdDataOut : std_logic_vector(7 downto 0); + signal MemAdr : std_logic_vector(23 downto 1); + signal FlashByte : std_logic; + signal RamCS : std_logic; + signal FlashCS : std_logic; + signal MemWR : std_logic; + signal MemOE : std_logic; + signal RamUB : std_logic; + signal RamLB : std_logic; + signal RamCre : std_logic; + signal RamAdv : std_logic; + signal RamClk : std_logic; + signal FlashRp : std_logic; + signal TestCtrlEnabled : std_logic; + signal seg : std_logic_vector(6 downto 0); + signal an : std_logic_vector(3 downto 0); + + -- Clock period definitions + constant clk_period : time := 10 ns; + constant RamClk_period : time := 10 ns; + +BEGIN + + -- Instantiate the Unit Under Test (UUT) + uut: NexysOnBoardMemTest PORT MAP ( + clk => clk, + HandShakeReqOut => HandShakeReqOut, + ctlMsmStartIn => ctlMsmStartIn, + ctlMsmDoneOut => ctlMsmDoneOut, + ctlMsmDwrIn => ctlMsmDwrIn, + ctlEppRdCycleIn => ctlEppRdCycleIn, + EppRdDataOut => EppRdDataOut, + EppWrDataIn => EppWrDataIn, + regEppAdrIn => regEppAdrIn, + ComponentSelect => ComponentSelect, + MemDB => MemDB, + MemAdr => MemAdr, + FlashByte => FlashByte, + RamCS => RamCS, + FlashCS => FlashCS, + MemWR => MemWR, + MemOE => MemOE, + RamUB => RamUB, + RamLB => RamLB, + RamCre => RamCre, + RamAdv => RamAdv, + RamClk => RamClk, + RamWait => RamWait, + FlashRp => FlashRp, + FlashStSts => FlashStSts, + TestCtrlEnabled => TestCtrlEnabled, + seg => seg, + an => an + ); + + -- Clock process definitions + clk_process :process + begin + clk <= '0'; + wait for clk_period/2; + clk <= '1'; + wait for clk_period/2; + end process; + + --RamClk_process :process + --begin + --RamClk <= '0'; + --wait for RamClk_period/2; + --RamClk <= '1'; + --wait for RamClk_period/2; + --end process; + + + -- Stimulus process + stim_proc: process + begin + -- hold reset state for 100 ns. + wait for 100 ns; + + wait for clk_period*10; +ComponentSelect <= '1'; +--EppWrDataIn <= "00000111"; +regEppAdrIn <= "11111111"; +--ctlMsmStartIn <= '1'; +--ctlMsmDwrIn <= '1'; +--ctlEppRdCycleIn <= '1'; + + -- insert stimulus here + + wait; + end process; + +END; diff --git a/top.bit b/top.bit new file mode 120000 index 0000000..f288092 --- /dev/null +++ b/top.bit @@ -0,0 +1 @@ +DemoWithMemCfg.bit \ No newline at end of file diff --git a/upload.sh b/upload.sh new file mode 100755 index 0000000..05cabe9 --- /dev/null +++ b/upload.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +impact -batch impact_top.ipf diff --git a/wave.wcfg b/wave.wcfg new file mode 100644 index 0000000..3f4018b --- /dev/null +++ b/wave.wcfg @@ -0,0 +1,1174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + demo + label + + clk + clk + + + usbclk + usbclk + + + an[3:0] + an[3:0] + + + seg[6:0] + seg[6:0] + + + usb + label + + usbdb[7:0] + usbdb[7:0] + + + usbadr[1:0] + usbadr[1:0] + + + usbflag + usbflag + + + usbmode + usbmode + + + usbdir + usbdir + + + usbpktend + usbpktend + + + usbwr + usbwr + + + usboe + usboe + + + + epp + label + + eppdstb + eppdstb + + + eppastb + eppastb + + + eppwait + eppwait + + + + ram + label + + ramcs + ramcs + + + flashcs + flashcs + + + memwr + memwr + + + memoe + memoe + + + ramub + ramub + + + ramlb + ramlb + + + ramcre + ramcre + + + ramadv + ramadv + + + ramclk + ramclk + + + ramwait + ramwait + + + flashrp + flashrp + + + flashststs + flashststs + + + memadr[23:1] + memadr[23:1] + HEXRADIX + + + memdb[15:0] + memdb[15:0] + HEXRADIX + + + + + eppctrl + label + + clk + clk + + + label + eppdbin[7:0] + eppdbin[7:0] + eppdbin[7:0] - usbdb + + + label + eppwr + eppwr + eppwr - usbflag + + + label + epprst + epprst + epprst - UsbMode + + + eppastb + eppastb + + + eppdstb + eppdstb + + + steppcur + steppcur + + + ctleppawr + ctleppawr + + + handshakereqin + handshakereqin + + + ctleppdwrout + ctleppdwrout + + + eppwait + eppwait + + + eppdbout[7:0] + eppdbout[7:0] + + + buseppout[7:0] + buseppout[7:0] + + + buseppin[7:0] + buseppin[7:0] + + + regeppadrout[7:0] + regeppadrout[7:0] + + + buseppinternal[7:0] + buseppinternal[7:0] + + + ctlepprdcycleout + ctlepprdcycleout + + + ctleppdonein + ctleppdonein + + + label + ctleppstartout + ctleppstartout + ctleppstartout + + + + memctrl + label + + ctlmsmstartin + ctlmsmstartin + + + ctlmsmdoneout + ctlmsmdoneout + + + ctlmcroe + ctlmcroe + + + ctlmcrflashcs + ctlmcrflashcs + + + regmemctl[7:0] + regmemctl[7:0] + + + stmsmcur[3:0] + stmsmcur[3:0] + + + stmsmnext[3:0] + stmsmnext[3:0] + + + componentselect + componentselect + + + regeppadrin[7:0] + regeppadrin[7:0] + + + clk + clk + + + handshakereqout + handshakereqout + + + ctlepprdcyclein + ctlepprdcyclein + + + ctlmsmdwrin + ctlmsmdwrin + + + epprddataout[7:0] + epprddataout[7:0] + + + eppwrdatain[7:0] + eppwrdatain[7:0] + + + memdb[15:0] + memdb[15:0] + HEXRADIX + + + memadr[23:1] + memadr[23:1] + HEXRADIX + + + flashbyte + flashbyte + + + ramcs + ramcs + + + flashcs + flashcs + + + memwr + memwr + + + memoe + memoe + + + ramub + ramub + + + ramlb + ramlb + + + ramcre + ramcre + + + ramadv + ramadv + + + ramclk + ramclk + + + ramwait + ramwait + + + flashrp + flashrp + + + flashststs + flashststs + + + memctrlenabled + memctrlenabled + + + delaycnt[4:0] + delaycnt[4:0] + + + regmemadr[23:0] + regmemadr[23:0] + UNSIGNEDDECRADIX + + + label + regmemadr[23:0] + regmemadr[23:0] + regmemadr[23:0] + + + carryoutl + carryoutl + + + carryoutm + carryoutm + + + regmemwrdata[15:0] + regmemwrdata[15:0] + + + regmemrddata[7:0] + regmemrddata[7:0] + + + regmemrddataaux[7:0] + regmemrddataaux[7:0] + + + busmemin[15:0] + busmemin[15:0] + HEXRADIX + + + busmemout[15:0] + busmemout[15:0] + HEXRADIX + + + ctlmcroe + ctlmcroe + + + ctlmcrwr + ctlmcrwr + + + ctlmcrramcs + ctlmcrramcs + + + ctlmcrflashcs + ctlmcrflashcs + + + ctlmcrenable + ctlmcrenable + + + ctlmcrword + ctlmcrword + + + ctlmcrdir + ctlmcrdir + + + ctlmsmoe + ctlmsmoe + + + ctlmsmwr + ctlmsmwr + + + ctlmsmramcs + ctlmsmramcs + + + ctlmsmflashcs + ctlmsmflashcs + + + ctlmsmdir + ctlmsmdir + + + ctlmsmadrinc + ctlmsmadrinc + + + ctlmsmwrcmd + ctlmsmwrcmd + + + + memtest + label + + clk + clk + + + handshakereqout + handshakereqout + + + ctlmsmstartin + ctlmsmstartin + + + ctlmsmdoneout + ctlmsmdoneout + + + ctlmsmdwrin + ctlmsmdwrin + + + ctlepprdcyclein + ctlepprdcyclein + + + epprddataout[7:0] + epprddataout[7:0] + + + eppwrdatain[7:0] + eppwrdatain[7:0] + + + regeppadrin[7:0] + regeppadrin[7:0] + + + componentselect + componentselect + + + memdb[15:0] + memdb[15:0] + HEXRADIX + + + memadr[23:1] + memadr[23:1] + HEXRADIX + + + flashbyte + flashbyte + + + ramcs + ramcs + + + flashcs + flashcs + + + memwr + memwr + + + memoe + memoe + + + ramub + ramub + + + ramlb + ramlb + + + ramcre + ramcre + + + ramadv + ramadv + + + ramclk + ramclk + + + ramwait + ramwait + + + flashrp + flashrp + + + flashststs + flashststs + + + testctrlenabled + testctrlenabled + + + sttestcur[3:0] + sttestcur[3:0] + + + sttestnext[3:0] + sttestnext[3:0] + + + stmsmcur[2:0] + stmsmcur[2:0] + + + stmsmnext[2:0] + stmsmnext[2:0] + + + delaycnt[4:0] + delaycnt[4:0] + + + regmemadr[23:0] + regmemadr[23:0] + HEXRADIX + + + carryoutl + carryoutl + + + carryoutm + carryoutm + + + regmemwrdata[15:0] + regmemwrdata[15:0] + HEXRADIX + + + regmemrddata[15:0] + regmemrddata[15:0] + HEXRADIX + + + busmemin[15:0] + busmemin[15:0] + HEXRADIX + + + busmemout[15:0] + busmemout[15:0] + HEXRADIX + + + ctlmsmoe + ctlmsmoe + + + ctlmsmwr + ctlmsmwr + + + ctlmsmramcs + ctlmsmramcs + + + ctlmsmflashcs + ctlmsmflashcs + + + ctlmsmdir + ctlmsmdir + + + ctlmsmwrcmd + ctlmsmwrcmd + + + flagtestrun + flagtestrun + + + flagmsmwrcycle + flagmsmwrcycle + + + flagrightcode + flagrightcode + + + cnttimer[25:0] + cnttimer[25:0] + UNSIGNEDDECRADIX + + + + blockram + label + + usbclk + usbclk + + + usbmode + usbmode + + + usbdir + usbdir + + + usboe + usboe + + + usbrd + usbrd + + + usbwr + usbwr + + + usbpktend + usbpktend + + + usbflag + usbflag + + + usbadr[1:0] + usbadr[1:0] + + + usbdbin[7:0] + usbdbin[7:0] + + + usbdbout[7:0] + usbdbout[7:0] + + + stream6bytes[47:0] + stream6bytes[47:0] + + + state + state + + + next_state + next_state + + + streamadr[14:0] + streamadr[14:0] + + + streamlen[31:0] + streamlen[31:0] + + + adrcounter[14:0] + adrcounter[14:0] + + + bytecounter[31:0] + bytecounter[31:0] + + + ramdo[7:0] + ramdo[7:0] + + + iusbop + iusbop + + + ramwr + ramwr + + + counterzero + counterzero + + + + uut + label + + clk + clk + + + memadr[23:1] + memadr[23:1] + HEXRADIX + + + memdb[15:0] + memdb[15:0] + HEXRADIX + + + btn[3:0] + btn[3:0] + + + eppastb + eppastb + + + eppdstb + eppdstb + + + flashststs + flashststs + + + ramwait + ramwait + + + rsrx + rsrx + + + sw[7:0] + sw[7:0] + + + usbclk + usbclk + + + usbdir + usbdir + + + usbflag + usbflag + + + usbmode + usbmode + + + an[3:0] + an[3:0] + + + dp + dp + + + eppwait + eppwait + + + flashcs + flashcs + + + flashrp + flashrp + + + hsync + hsync + + + led[7:0] + led[7:0] + + + memoe + memoe + + + memwr + memwr + + + ramadv + ramadv + + + ramclk + ramclk + + + ramcre + ramcre + + + ramcs + ramcs + + + ramlb + ramlb + + + ramub + ramub + + + seg[6:0] + seg[6:0] + + + usbadr[1:0] + usbadr[1:0] + + + usboe + usboe + + + usbpktend + usbpktend + + + usbwr + usbwr + + + vgablue[2:1] + vgablue[2:1] + + + vgagreen[2:0] + vgagreen[2:0] + + + vgared[2:0] + vgared[2:0] + + + vsync + vsync + + + pio[67:0] + pio[67:0] + + + ps2c + ps2c + + + ps2d + ps2d + + + rstx + rstx + + + usbdb[7:0] + usbdb[7:0] + + + xlxn_1487[7:0] + xlxn_1487[7:0] + + + xlxn_1488 + xlxn_1488 + + + xlxn_1526[7:0] + xlxn_1526[7:0] + + + xlxn_1527 + xlxn_1527 + + + xlxn_1579 + xlxn_1579 + + + xlxn_1747[3:0] + xlxn_1747[3:0] + + + xlxn_1748[3:0] + xlxn_1748[3:0] + + + xlxn_1749[3:0] + xlxn_1749[3:0] + + + xlxn_1750 + xlxn_1750 + + + xlxn_1751 + xlxn_1751 + + + xlxn_1848[3:0] + xlxn_1848[3:0] + + + xlxn_1849 + xlxn_1849 + + + xlxn_1852[6:0] + xlxn_1852[6:0] + + + xlxn_1882 + xlxn_1882 + + + xlxn_1902 + xlxn_1902 + + + xlxn_1938 + xlxn_1938 + + + xlxn_1939[6:0] + xlxn_1939[6:0] + + + xlxn_1940[3:0] + xlxn_1940[3:0] + + + xlxn_1944[7:0] + xlxn_1944[7:0] + + + xlxn_1947 + xlxn_1947 + + + xlxn_1948 + xlxn_1948 + + + xlxn_1949 + xlxn_1949 + + + xlxn_2184[7:0] + xlxn_2184[7:0] + + + xlxn_2186[7:0] + xlxn_2186[7:0] + + + xlxn_2187[7:0] + xlxn_2187[7:0] + + + xlxn_2196[7:0] + xlxn_2196[7:0] + + + xlxn_2212[47:0] + xlxn_2212[47:0] + + + xlxn_2230[7:0] + xlxn_2230[7:0] + + + xlxn_2235 + xlxn_2235 + + + xlxn_2236 + xlxn_2236 + + + xlxn_2237 + xlxn_2237 + + + xlxn_2238 + xlxn_2238 + + + xlxn_2239 + xlxn_2239 + + + xlxn_2252 + xlxn_2252 + + + xlxn_2549[7:0] + xlxn_2549[7:0] + + + xlxn_2550[1:0] + xlxn_2550[1:0] + + + xlxn_2570 + xlxn_2570 + + + ramlb_dummy + ramlb_dummy + + + memoe_dummy + memoe_dummy + + + ramadv_dummy + ramadv_dummy + + + flashrp_dummy + flashrp_dummy + + + ramub_dummy + ramub_dummy + + + ramcs_dummy + ramcs_dummy + + + memwr_dummy + memwr_dummy + + + flashcs_dummy + flashcs_dummy + + + memadr_dummy[23:1] + memadr_dummy[23:1] + HEXRADIX + + + ramcre_dummy + ramcre_dummy + + + ramclk_dummy + ramclk_dummy + + + + compsel + label + + regeppadrin[7:0] + regeppadrin[7:0] + + + cs80_9f + cs80_9f + + + cs0_7 + cs0_7 + + + cs8_f + cs8_f + + + cs10 + cs10 + + + csb0 + csb0 + + +