📄 cy7c1380d.vhd
字号:
CE_HZ <= '0' after Cyp_tCHZ; elsif ((ce_reg1 = '1') and (pipe_reg1 = '1')) then CE_HZ <= '1' after Cyp_tCHZ; else CE_HZ <= 'X' after Cyp_tCHZ; end if; end process; Process (Sys_clk) TYPE memory_array IS ARRAY ((2**addr_bits -1) DOWNTO 0) OF STD_LOGIC_VECTOR ((data_bits/4) - 1 DOWNTO 0); variable Read_reg_o : std_logic; variable Read_reg : std_logic; variable pcsr_write, ctlr_write : std_logic; variable WrN_reg : std_logic; variable latch_addr_old, latch_addr_current : std_logic; variable addr_reg_in, addr_reg_read, addr_reg_write : std_logic_vector (addr_bits -1 downto 0) := (others => '0'); variable bcount, first_addr : std_logic_vector (1 downto 0) := "00"; variable bwa_reg,bwb_reg,bwc_reg,bwd_reg, pipe_reg, ce_reg : std_logic; variable din : std_logic_vector (data_bits-1 downto 0); variable first_addr_int : integer; variable bank0 : memory_array; variable bank1 : memory_array; variable bank2 : memory_array; variable bank3 : memory_array; variable FIRST : boolean := true; file TCF : text open read_mode is fname; variable rectype : std_logic_vector(3 downto 0); variable recaddr : std_logic_vector(31 downto 0); variable reclen : std_logic_vector(7 downto 0); variable recdata : std_logic_vector(0 to 16*8-1); variable CH : character; variable ai : integer := 0; variable L1 : line; begin if FIRST then L1:= new string'(""); while not endfile(TCF) loop readline(TCF,L1); if (L1'length /= 0) then while (not (L1'length=0)) and (L1(L1'left) = ' ') loop std.textio.read(L1,CH); end loop; if L1'length > 0 then std.textio.read(L1, ch); if (ch = 'S') or (ch = 's') then hexread(L1, rectype); hexread(L1, reclen); recaddr := (others => '0'); case rectype is when "0001" => hexread(L1, recaddr(15 downto 0)); when "0010" => hexread(L1, recaddr(23 downto 0)); when "0011" => hexread(L1, recaddr); recaddr(31 downto 24) := (others => '0'); when others => next; end case; hexread(L1, recdata); ai := conv_integer(recaddr)/4; for i in 0 to 3 loop bank3 (ai+i) := "0000" & recdata((i*32) to (i*32+4)); bank2 (ai+i) := recdata((i*32+5) to (i*32+13)); bank1 (ai+i) := recdata((i*32+14) to (i*32+22)); bank0 (ai+i) := recdata((i*32+23) to (i*32+31)); end loop; end if; end if; end if; end loop; FIRST := false; end if; if rising_edge (Sys_clk) then if (Write_n = '0') then Read_reg_o := '0'; else Read_reg_o := Read_reg; end if; if (Write_n = '0') then Read_reg := '0'; else Read_reg := Read; end if; Read_reg1 <= Read_reg; Read_reg_o1 <= Read_reg_o; if (Read_reg = '1') then pcsr_write := '0'; ctlr_write := '0'; end if; -- Write Register if (Read_reg_o = '1') then WrN_reg := '1'; else WrN_reg := Write_n; end if; WrN_reg1 <= WrN_reg; latch_addr_old := latch_addr_current; latch_addr_current := latch_addr; if (latch_addr_old = '1' and (Write_n = '0') and ADSP_N_o = '0') then pcsr_write := '1'; --Ctlr Write = 0; Pcsr Write = 1; elsif (latch_addr_current = '1' and (Write_n = '0') and inADSP = '1' and inADSC = '0') then ctlr_write := '1'; --Ctlr Write = 0; Pcsr Write = 1; end if; -- ADDRess Register if (latch_addr = '1') then addr_reg_in := iADDR; bcount := iADDR (1 downto 0); first_addr := iADDR (1 downto 0); end if; addr_reg_in1 <= addr_reg_in; -- ADSP_N Previous-Cycle Register ADSP_N_o <= inADSP; pcsr_write1 <= pcsr_write; ctlr_write1 <= ctlr_write; first_addr_int := CONV_INTEGER1 (first_addr); -- Binary Counter and Logic if ((iMode = '0') and (inADV = '0') and (latch_addr = '0')) then -- Linear Burst bcount := (bcount + '1'); -- Advance Counter elsif ((iMode = '1') and (inADV = '0') and (latch_addr = '0')) then -- Interleaved Burst if ((first_addr_int REM 2) = 0) then bcount := (bcount + '1'); -- Increment Counter elsif ((first_addr_int REM 2) = 1) then bcount := (bcount - '1'); -- Decrement Counter end if; end if; -- Read ADDRess addr_reg_read := addr_reg_write; addr_reg_read1 <= addr_reg_read; -- Write ADDRess addr_reg_write := addr_reg_in ((addr_bits - 1) downto 2) & bcount(1) & bcount(0); addr_reg_write1 <= addr_reg_write; -- Byte Write Register bwa_reg := not bwa_n1; bwb_reg := not bwb_n1; bwc_reg := not bwc_n1; bwd_reg := not bwd_n1; -- Enable Register pipe_reg := ce_reg; -- Enable Register if (latch_addr = '1') then ce_reg := ce; end if; pipe_reg1 <= pipe_reg; ce_reg1 <= ce_reg; -- Input Register if ((ce_reg = '1') and ((bwa_n1 ='0') or (bwb_n1 = '0') or (bwc_n1 = '0') or (bwd_n1 = '0')) and ((pcsr_write = '1') or (ctlr_write = '1'))) then din := ioDQ; end if; din1 <= din; -- Byte Write Driver if ((ce_reg = '1') and (bwa_reg = '1')) then bank0 (CONV_INTEGER1 (addr_reg_write)) := din (8 downto 0); end if; if ((ce_reg = '1') and (bwb_reg = '1')) then bank1 (CONV_INTEGER1 (addr_reg_write)) := din (17 downto 9); end if; if ((ce_reg = '1') and (bwc_reg = '1')) then bank2 (CONV_INTEGER1 (addr_reg_write)) := din (26 downto 18); end if; if ((ce_reg = '1') and (bwd_reg = '1')) then bank3 (CONV_INTEGER1 (addr_reg_write)) := din (35 downto 27); end if; -- Output Registers if ((Write_n = '0') or (pipe_reg = '0')) then dout (35 downto 0) <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" after Cyp_tCHZ; elsif (Read_reg_o = '1') then dout ( 8 downto 0) <= bank0 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO; dout (17 downto 9) <= bank1 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO; dout (26 downto 18) <= bank2 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO; dout (35 downto 27) <= bank3 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO; end if; end if; end process; -- Output Buffers ioDQ <= dout when ((inOE ='0') and (iZZ='0') and (Pipe_efct='1') and (RD_efct='1') and (WR_efct='1')) else "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; clk_check : PROCESS VARIABLE clk_high, clk_low : TIME := 0 ns; BEGIN WAIT ON iClk; IF iClk = '1' AND NOW >= Cyp_tCYC THEN ASSERT (NOW - clk_low >= Cyp_tCH) REPORT "Clk width low - tCH violation" SEVERITY ERROR; ASSERT (NOW - clk_high >= Cyp_tCYC) REPORT "Clk period high - tCYC violation" SEVERITY ERROR; clk_high := NOW; ELSIF iClk = '0' AND NOW /= 0 ns THEN ASSERT (NOW - clk_high >= Cyp_tCL) REPORT "Clk width high - tCL violation" SEVERITY ERROR; ASSERT (NOW - clk_low >= Cyp_tCYC) REPORT "Clk period low - tCYC violation" SEVERITY ERROR; clk_low := NOW; END IF; END PROCESS; -- Check for Setup Timing Violation setup_check : PROCESS BEGIN WAIT ON iClk; IF iClk = '1' THEN ASSERT (iAddr'LAST_EVENT >= Cyp_tAS) REPORT "Addr - tAS violation" SEVERITY ERROR; ASSERT (inGW'LAST_EVENT >= Cyp_tWES) REPORT "GW# - tWES violation" SEVERITY ERROR; ASSERT (inBWE'LAST_EVENT >= Cyp_tWES) REPORT "BWE# - tWES violation" SEVERITY ERROR; ASSERT (inCe1'LAST_EVENT >= Cyp_tWES) REPORT "CE1# - tWES violation" SEVERITY ERROR; ASSERT (iCe2'LAST_EVENT >= Cyp_tWES) REPORT "CE2 - tWES violation" SEVERITY ERROR; ASSERT (inCe3'LAST_EVENT >= Cyp_tWES) REPORT "CE3# - tWES violation" SEVERITY ERROR; ASSERT (inAdv'LAST_EVENT >= Cyp_tADVS) REPORT "ADV# - tWES violation" SEVERITY ERROR; ASSERT (inAdsp'LAST_EVENT >= Cyp_tADVS) REPORT "ADSP# - tWES violation" SEVERITY ERROR; ASSERT (inAdsc'LAST_EVENT >= Cyp_tADVS) REPORT "ADSC# - tWES violation" SEVERITY ERROR; ASSERT (inBwa'LAST_EVENT >= Cyp_tWES) REPORT "BWa# - tWES violation" SEVERITY ERROR; ASSERT (inBwb'LAST_EVENT >= Cyp_tWES) REPORT "BWb# - tWES violation" SEVERITY ERROR; ASSERT (inBwc'LAST_EVENT >= Cyp_tWES) REPORT "BWc# - tWES violation" SEVERITY ERROR; ASSERT (inBwd'LAST_EVENT >= Cyp_tWES) REPORT "BWd# - tWES violation" SEVERITY ERROR; ASSERT (ioDq'LAST_EVENT >= Cyp_tDS) REPORT "Dq - tDS violation" SEVERITY ERROR; END IF; END PROCESS; -- Check for Hold Timing Violation hold_check : PROCESS BEGIN WAIT ON iClk'DELAYED(Cyp_tAH), iClk'DELAYED(Cyp_tWEH), iClk'DELAYED(Cyp_tDH); IF iClk'DELAYED(Cyp_tAH) = '1' THEN ASSERT (iAddr'LAST_EVENT > Cyp_tAH) REPORT "Addr - tAH violation" SEVERITY ERROR; END IF; IF iClk'DELAYED(Cyp_tDH) = '1' THEN ASSERT (ioDq'LAST_EVENT > Cyp_tDH) REPORT "Dq - tDH violation" SEVERITY ERROR; END IF; IF iClk'DELAYED(Cyp_tWEH) = '1' THEN ASSERT (inCe1'LAST_EVENT > Cyp_tWEH) REPORT "CE1# - tWEH violation" SEVERITY ERROR; ASSERT (iCe2'LAST_EVENT > Cyp_tWEH) REPORT "CE2 - tWEH violation" SEVERITY ERROR; ASSERT (inCe3'LAST_EVENT > Cyp_tWEH) REPORT "CE3 - tWEH violation" SEVERITY ERROR; ASSERT (inAdv'LAST_EVENT > Cyp_tWEH) REPORT "ADV# - tWEH violation" SEVERITY ERROR; ASSERT (inADSP'LAST_EVENT > Cyp_tWEH) REPORT "ADSP# - tWEH violation" SEVERITY ERROR; ASSERT (inADSC'LAST_EVENT > Cyp_tWEH) REPORT "ADSC# - tWEH violation" SEVERITY ERROR; ASSERT (inBwa'LAST_EVENT > Cyp_tWEH) REPORT "BWa# - tWEH violation" SEVERITY ERROR; ASSERT (inBwb'LAST_EVENT > Cyp_tWEH) REPORT "BWb# - tWEH violation" SEVERITY ERROR; ASSERT (inBwc'LAST_EVENT > Cyp_tWEH) REPORT "BWc# - tWEH violation" SEVERITY ERROR; ASSERT (inBwd'LAST_EVENT > Cyp_tWEH) REPORT "BWd# - tWEH violation" SEVERITY ERROR; END IF; END PROCESS;end CY7C1380D_arch;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -