亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? up_model.vhd

?? IIC的IP.這是經過驗證的源代碼
?? VHD
?? 第 1 頁 / 共 2 頁
字號:
------------------------------------------------------------------------------
-- 
--  Name:  up_model.vhd  
-- 
--  Description:  Emulate microprocessor transactions to the I2C master
-- 
--  $Revision: 1.0 $          
--  
--  Copyright 2004 Lattice Semiconductor Corporation.  All rights reserved.
--
------------------------------------------------------------------------------
-- Permission:
--
--   Lattice Semiconductor grants permission to use this code for use
--   in synthesis for any Lattice programmable logic product.  Other
--   use of this code, including the selling or duplication of any
--   portion is strictly prohibited.
--
-- Disclaimer:
--
--   This VHDL or Verilog source code is intended as a design reference
--   which illustrates how these types of functions can be implemented.
--   It is the user's responsibility to verify their design for
--   consistency and functionality through the use of formal
--   verification methods.  Lattice Semiconductor provides no warranty
--   regarding the use or functionality of this code.
------------------------------------------------------------------------------
--
--    Lattice Semiconductor Corporation
--    5555 NE Moore Court
--    Hillsboro, OR 97124
--    U.S.A
--
--    TEL: 1-800-Lattice (USA and Canada)
--    408-826-6000 (other locations)
--
--    web: http://www.latticesemi.com/
--    email: techsupport@latticesemi.com
-- 
------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned."-";
use ieee.std_logic_unsigned."+";
use ieee.std_logic_textio.all;         
use std.textio.all;                    
use ieee.numeric_std.all;              

 
entity up_model is port(clk     : in std_logic;
                        reset_l : in std_logic;
                        ack_l   : in std_logic;
                        intr_l  : in std_logic;
                        rw_l    : out std_logic;
                        cs_l    : out std_logic;
                        addr    : out std_logic_vector(2 downto 0);
                        data    : inout std_logic_vector(7 downto 0));
end up_model;


architecture behave of up_model is              

-- --------------------------------------------------------------------
-- Constants

-- defining the address map as constants
constant data_buf      : std_logic_vector(2 downto 0) := "000";
constant low_addr      : std_logic_vector(2 downto 0) := "001";
constant upper_addr    : std_logic_vector(2 downto 0) := "010";
constant master_code   : std_logic_vector(2 downto 0) := "011";
constant comm_stat     : std_logic_vector(2 downto 0) := "100";
constant byte_count    : std_logic_vector(2 downto 0) := "101";
constant iack_reg      : std_logic_vector(2 downto 0) := "110";


-----------------------------------------------------------------------
-- reg declarations
signal data_ret : std_logic_vector(7 downto 0) := "00000000";
signal cntr     : std_logic_vector(7 downto 0) := "00000000";
signal cntr2    : std_logic_vector(13 downto 0) := "00000000000000";
signal cntr3    : std_logic_vector(13 downto 0) := "00000000000000";
signal not_used : std_logic_vector(7 downto 0):= "00000000";
signal data_out : std_logic_vector(7 downto 0):= "00000000";
------------------------------------------
-- variables

signal num_errors : integer:= 0;
signal int_flag   : integer:= 0; 
signal empty_flag : integer:= 0;  
signal done_flag  : integer:= 0; 
signal full_flag  : integer:= 0; 
signal RWL        : std_logic:= '0'; -- intermediate rw_l signal for tristate problem



begin
-----------------------------------------------------------------------
-- tri-state buffer for data bus
rw_l <= RWL;
data <= data_out when RWL = '0' else "ZZZZZZZZ";
--data <= data_out when RWL = '0' else "HHHHHHHH";
---------------------------------------------------------------------------

--//    Module  up_model
--// This module provides micro processor transactions to the I2C Master.
--// It is the stimulus control block for the top level simulation.


--init 2;
-------------------------------------------------------------------------
-- Initial Block to call uP tasks
-- These tasks read and write the appropriate data to the I2C master
-- This is the heart of the simulation because all tests are called from
-- here
--procedure init2 is
init2 : process

--//-------------------------------------------------------------------------
--// error_check

procedure error_check is
 variable L : line;
  begin 
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Simulation complete with "));
    write(L, num_errors);
    write(L, string'(" errors. "));
    writeline(output,L);   

end error_check; 

--//--------------------------------------------------------------------------
--// kill_time
procedure kill_time is
begin 
  
  wait until rising_edge(clk);
  wait until rising_edge(clk);
  wait until rising_edge(clk);
  wait until rising_edge(clk);
    
  
end kill_time;


--// -----------------------------------------------------------------------
--// Define the uP Tasks
--// ----------------------------------------------------------------------
--// write_data_buf
procedure write_data_buf
          (data_in   : in std_logic_vector(7 downto 0)) is
 variable L : line;
 begin 
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L,string'(" Writing Data Buf "));
    write(L, data_in);
    writeline(output,L);   

    addr <= data_buf;  
    RWL <= '0';
    data_out <= data_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL  <= '1';
end write_data_buf;
  

--// ----------------------------------------------------------------------
--// read_data_buf

procedure read_data_buf
          (expected   : in std_logic_vector(7 downto 0);
           signal data_back  : out std_logic_vector(7 downto 0)) is
 variable L : line;
 begin 
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L,string'(" Reading Data Buf Reg "));
    writeline(output,L);   
    addr  <= data_buf;
    RWL <= '1'; 
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Read Data "));
    write(L, data);
    writeline(output,L);   

    data_back <= data; --// The value returned from the task
  wait until rising_edge(clk);
    cs_l  <= '1';
    RWL  <= '1'; 
 
    if (data /= expected) then 
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" ERROR: data returned = "));
    write(L, data);
    write(L, string'(" data_expected = "));
    write(L, expected);
    writeline(output,L);   
     num_errors <= num_errors + 1; 
    end if;

end read_data_buf;   
  




--// ----------------------------------------------------------------------
--// write_low_add

procedure write_low_add
          (addr_in  : in std_logic_vector(7 downto 0)) is
 variable L : line;
 begin
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Writing Low Addr Reg "));
    write(L, addr_in);
    writeline(output,L);   

    addr <= low_addr;  
    RWL <= '0';
    data_out <= addr_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL     <= '1';

end write_low_add;  

--// ----------------------------------------------------------------------
--// write_upper_add
procedure write_upper_add
          (addr_in : in std_logic_vector(7 downto 0)) is
 variable L : line;
 begin 
  kill_time;   
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Writing Upper Addr Reg "));
    write(L, addr_in);
    writeline(output,L);   

    addr <= upper_addr;  
    RWL <= '0';
    data_out <= addr_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL  <= '1';

end write_upper_add; 



--// ----------------------------------------------------------------------
--// write_master_code
procedure write_master_code
          (data_in : in std_logic_vector(7 downto 0)) is
 variable L : line;
 begin 
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Writing Master Code Reg "));
    write(L, data_in);
    writeline(output,L);   

    addr <= master_code;  
    RWL <= '0';
    data_out <= data_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL  <= '1';
end write_master_code;
  


--// ----------------------------------------------------------------------
--// write_command_reg
procedure write_command_reg
          (data_in : in std_logic_vector(7 downto 0)) is
 variable L : line;
 begin 
  kill_time;   
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Writing Command Reg "));
    write(L, data_in);
    writeline(output,L);   

    addr <= comm_stat;  
    RWL <= '0';
    data_out <= data_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL  <= '1';

end write_command_reg;



--// ----------------------------------------------------------------------
--// read_status_reg
procedure read_status_reg
          (debug : in std_logic;
           signal data_back : out std_logic_vector(7 downto 0)) is --// pass a 1 to turn debug on & a 0 to turn it off
 variable L : line;
 begin 
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Reading Status Reg "));
    writeline(output,L);   

  addr  <= comm_stat;
  RWL  <= '1'; 
  wait until rising_edge(clk);
    cs_l  <= '0';
  wait until ack_l = '0';
  if (debug = '1') then
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" uP Read Data "));
    write(L, data);
    writeline(output,L);   

  end if;
  data_back <= data; --// The value returned from the task
    wait until rising_edge(clk);
    cs_l  <= '1';
    RWL  <= '1'; 
 
end read_status_reg;
 
--//--------------------------------------------------------------------------
--// check_done task
procedure check_done is
   variable L : line;
  begin 
  
  -- check for done bit before continuing
  
 
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Checking the done bit "));
    writeline(output,L);   

  -- initialize some variables
   cntr <= "00000000";
   done_flag <= 0;
   
   -- start checking status
   while (cntr /= "11111111" and done_flag = 0) loop 
     wait until rising_edge(clk);
     wait until rising_edge(clk);
     -- read the status
     read_status_reg('0',data_ret);
      
     if (data_ret(3) = '1') then 
     -- we have the done bit so set the done flag
       done_flag <= 1;
     else 
     -- status says not done
        cntr <= cntr + 1;
     end if;
   end loop; -- end of while

   if (cntr = "11111111") then 
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" ERROR cntr expired waiting for Done Flag!"));
    writeline(output,L);   

     num_errors <= num_errors + 1;
   end if;  
 
end check_done;



--// ----------------------------------------------------------------------
--// write_byte_count
procedure write_byte_count 
          (data_in : std_logic_vector(7 downto 0)) is
 variable L : line;
 begin
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Writing Byte Count "));
    write(L, data_in);
    writeline(output,L);   

    addr <= byte_count;  
    RWL <= '0';
    data_out <= data_in;  
  wait until rising_edge(clk);
    cs_l     <= '0';
  wait until ack_l = '0';
  wait until rising_edge(clk);
    cs_l     <= '1';
  wait until rising_edge(clk);
    RWL  <= '1';
  
end write_byte_count;



--// ----------------------------------------------------------------------
--// clear_iack
procedure clear_iack is
 variable L : line;
begin
  kill_time;
  wait until rising_edge(clk);
    write(L,now, justified => right, field=>10,unit=>ns);
    write(L, string'(" Clearing Iack Reg "));
    writeline(output,L);   

    addr <= iack_reg;  
    RWL <= '0';
    data_out <= "00000000";  
  wait until rising_edge(clk);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av影院在线| 精品日韩99亚洲| 精品区一区二区| 亚洲精品日韩综合观看成人91| 天堂成人免费av电影一区| 国产精品资源网站| 欧美日韩一区二区三区四区| 久久久天堂av| 蜜臀av性久久久久蜜臀aⅴ四虎| 91亚洲精品一区二区乱码| 久久久久99精品国产片| 亚洲国产一区二区视频| 波多野结衣欧美| 久久久久久久网| 免费观看成人av| 欧美日韩一区二区三区高清| 中文字幕在线观看不卡| 国产成人亚洲综合a∨婷婷图片| 欧美久久久一区| 午夜视频一区在线观看| 在线观看视频一区二区| 亚洲欧美一区二区三区孕妇| 国产白丝精品91爽爽久久| 日韩欧美激情一区| 美国av一区二区| 日韩欧美电影在线| 日本伊人色综合网| 欧美日韩精品一二三区| 亚洲一区二区三区视频在线 | 国产欧美日韩另类视频免费观看| 日韩中文字幕麻豆| 884aa四虎影成人精品一区| 一个色在线综合| 欧日韩精品视频| 婷婷六月综合亚洲| 欧美高清精品3d| 麻豆精品在线观看| 久久亚洲精品小早川怜子| 国内精品国产成人| 26uuu成人网一区二区三区| 国产一区二区视频在线| 国产亚洲美州欧州综合国| 国产做a爰片久久毛片| 欧美精品粉嫩高潮一区二区| 久久综合狠狠综合久久综合88 | 精品一区二区三区免费播放| 日韩一区二区三区观看| 蜜臂av日日欢夜夜爽一区| 日韩欧美国产精品| 国产99精品视频| 亚洲女爱视频在线| 欧美喷潮久久久xxxxx| 久久精品国产亚洲aⅴ| 久久久国产精品不卡| 91在线看国产| 婷婷成人激情在线网| 欧美电影精品一区二区| 国产精品白丝av| 一区二区三区不卡在线观看 | 色婷婷亚洲一区二区三区| 一区二区激情小说| 日韩三级视频在线观看| 福利91精品一区二区三区| 亚洲宅男天堂在线观看无病毒| 3atv在线一区二区三区| 国产很黄免费观看久久| 亚洲午夜久久久久久久久电影网| 日韩网站在线看片你懂的| 国产aⅴ综合色| 亚洲欧美色图小说| 精品国产第一区二区三区观看体验 | 久久精品免视看| 91精彩视频在线| 国产一区二区免费在线| 又紧又大又爽精品一区二区| 精品剧情v国产在线观看在线| a美女胸又www黄视频久久| 午夜精品久久久久久久99樱桃| 久久夜色精品国产欧美乱极品| 色欧美片视频在线观看| 国产精品一区二区91| 日韩精品乱码免费| 国产精品国产a级| 欧美精品一区二区三区视频| 色8久久精品久久久久久蜜| 国产一区二区三区精品视频| 亚洲福利视频三区| 中文字幕人成不卡一区| 亚洲精品一区二区三区四区高清| 欧美在线免费观看亚洲| 国产a精品视频| 国内精品国产成人| 青椒成人免费视频| 亚洲综合免费观看高清在线观看| 国产亚洲精品aa| 日韩女优毛片在线| 91麻豆精品国产91久久久更新时间| 91网站最新地址| av不卡免费电影| 丁香另类激情小说| 国产在线视频精品一区| 蜜臀av性久久久久蜜臀av麻豆| 亚洲一区二区三区中文字幕在线| 国产精品不卡视频| 国产欧美日韩亚州综合| 国产日产欧产精品推荐色 | 欧美喷水一区二区| 在线观看一区二区视频| 97国产精品videossex| 成人高清伦理免费影院在线观看| 国产一区二区三区| 国产麻豆视频精品| 国产美女视频一区| 国产精品一区二区三区99| 国产自产v一区二区三区c| 国内精品国产成人国产三级粉色 | 久久久www成人免费无遮挡大片| 日韩欧美视频在线| 精品少妇一区二区三区视频免付费| 欧美一区二区私人影院日本| 欧美高清视频一二三区 | 视频一区国产视频| 亚洲电影欧美电影有声小说| 婷婷综合五月天| 秋霞av亚洲一区二区三| 看电影不卡的网站| 国产成人啪午夜精品网站男同| 精品一区二区三区免费播放| 国产精品18久久久久久久久久久久 | 日韩一区二区电影| 日韩欧美成人一区二区| 国产欧美一区二区在线观看| 国产精品久久久一区麻豆最新章节| 亚洲欧美偷拍另类a∨色屁股| 亚洲视频每日更新| 天天色图综合网| 激情欧美一区二区| 菠萝蜜视频在线观看一区| 欧美午夜片在线看| 精品va天堂亚洲国产| 国产精品成人网| 亚洲电影在线免费观看| 免费成人美女在线观看.| 国产精品1区2区3区| 色av一区二区| 2023国产精品| 亚洲一区二区三区四区的| 久久精品国产精品青草| 成人激情小说网站| 欧美精品亚洲一区二区在线播放| 久久综合久久99| 亚洲国产日产av| 国产精品资源网站| 欧美乱妇一区二区三区不卡视频| 日韩女优视频免费观看| 日韩理论在线观看| 麻豆精品一区二区三区| 91黄视频在线| 久久精品人人做人人综合| 午夜天堂影视香蕉久久| 成人精品免费网站| 日韩一区二区三区免费看| 亚洲区小说区图片区qvod| 免费看日韩精品| 91视频com| 久久综合视频网| 午夜日韩在线观看| 91女厕偷拍女厕偷拍高清| 久久综合999| 日韩电影免费在线看| av不卡免费在线观看| 久久综合五月天婷婷伊人| 亚洲成人av福利| 91论坛在线播放| 国产人成一区二区三区影院| 日韩黄色免费电影| 欧洲一区在线电影| 中文字幕人成不卡一区| 国产一区二区三区免费看| 69久久夜色精品国产69蝌蚪网| 中文字幕一区视频| 国产成人免费视频一区| 7799精品视频| 午夜免费久久看| 在线观看精品一区| 亚洲视频在线观看三级| 丁香网亚洲国际| 久久先锋资源网| 国产酒店精品激情| 欧美mv日韩mv亚洲| 免费欧美日韩国产三级电影| 欧美日本一区二区三区| 亚洲精品国产一区二区三区四区在线| 国产成人自拍网| 国产午夜精品一区二区三区视频| 老司机午夜精品99久久| 欧美一级日韩免费不卡| 五月天激情综合网| 4438成人网| 久久99国产乱子伦精品免费|