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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mc8051_tmrctr.vhd

?? Standard 8051 IP Core
?? VHD
?? 第 1 頁 / 共 2 頁
字號:
--         Description: Timer/Counter unit of the mc8051 microcontroller.
--
--
--
--
-------------------------------------------------------------------------------
library IEEE; 
use IEEE.std_logic_1164.all; 
use IEEE.std_logic_arith.all; 
  
-----------------------------ENTITY DECLARATION--------------------------------

entity mc8051_tmrctr is

  port (clk        : in  std_logic;  			--< system clock
        reset      : in  std_logic;  			--< system reset
        int0_i     : in  std_logic;  			--< interrupt 0
        int1_i     : in  std_logic;  			--< interrupt 1
        t0_i       : in  std_logic;  			--< external clock for
  							--  timer/counter0
        t1_i       : in  std_logic;  			--< external clock for
  							--  timer/counter1
        tmod_i     : in  std_logic_vector(7 downto 0);  --< from SFR register
        tcon_tr0_i : in  std_logic;  			--< timer run 0
        tcon_tr1_i : in  std_logic;  			--< timer run 1
        reload_i   : in  std_logic_vector(7 downto 0);  --< to load counter
        wt_en_i    : in  std_logic;  			--< indicates reload
        wt_i       : in  std_logic_vector(1 downto 0);  --< reload which reg.
        th0_o      : out std_logic_vector(7 downto 0);  --< contents of th0 
        tl0_o      : out std_logic_vector(7 downto 0);  --< contents of tl0 
        th1_o      : out std_logic_vector(7 downto 0);  --< contents of th1 
        tl1_o      : out std_logic_vector(7 downto 0);  --< contents of tl1 
        tf0_o      : out std_logic;  			--< interrupt flag 0
        tf1_o      : out std_logic);  			--< interrupt flag 1
      
end mc8051_tmrctr;
-------------------------------------------------------------------------------
architecture rtl of mc8051_tmrctr is

  signal s_pre_count    : unsigned(3 downto 0);  -- these two signals provide
  signal s_count_enable : std_logic;             -- a clock enable signal which
                                                 -- masks out every twelfth           ***
                                                 -- rising edge of clk
  
  signal s_count0       : unsigned(15 downto 0); -- count for tmr/ctr0
  signal s_countl0      : unsigned(7 downto 0);  -- count register for tmr/ctr0
  signal s_counth0      : unsigned(7 downto 0);  -- count register for tmr/ctr0
  signal s_count1       : unsigned(15 downto 0); -- count for tmr/ctr1
  signal s_countl1      : unsigned(7 downto 0);  -- count register for tmr/ctr1
  signal s_counth1      : unsigned(7 downto 0);  -- count register for tmr/ctr1
  signal s_gate0        : std_logic;             -- gate bit for tmr/ctr 0
  signal s_gate1        : std_logic;             -- gate bit for tmr/ctr 1
  signal s_c_t0         : std_logic;             -- tmr/ctr 0 is timer if 0
  signal s_c_t1         : std_logic;             -- tmr/ctr 1 is timer if 0
  signal s_tmr_ctr0_en  : std_logic;             -- starts tmr/ctr 0 if 1
  signal s_tmr_ctr1_en  : std_logic;             -- starts tmr/ctr 1 if 1
  signal s_mode0        : unsigned(1 downto 0);  -- mode of tmr/ctr 0
  signal s_mode1        : unsigned(1 downto 0);  -- mode of tmr/ctr 1
  signal s_tf0          : std_logic;             -- overflow flag of tmr/ctr 0
  signal s_tf1          : std_logic;             -- overflow flag of tmr/ctr 1
  signal s_t0ff0        : std_logic;             -- flipflop for edge dedection
  signal s_t0ff1        : std_logic;             -- flipflop for edge dedection
  signal s_t0ff2        : std_logic;             -- flipflop for edge dedection
  signal s_t1ff0        : std_logic;             -- flipflop for edge dedection
  signal s_t1ff1        : std_logic;             -- flipflop for edge dedection
  signal s_t1ff2        : std_logic;             -- flipflop for edge dedection
  signal s_ext_edge0    : std_logic;             -- 1 if external edge dedected
  signal s_ext_edge1    : std_logic;             -- 1 if external edge dedected
  signal s_int0_sync    : std_logic;             -- synchronized int0 input              *** 
  signal s_int1_sync    : std_logic;             -- synchronized int1 input              *** 
  
  
  
begin                 -- architecture rtl

  -- The names of the following signals make the code more readable.
  s_gate0 <= tmod_i(3);
  s_c_t0  <= tmod_i(2);
  s_mode0(1) <= tmod_i(1);
  s_mode0(0) <= tmod_i(0);
  
  s_gate1 <= tmod_i(7);
  s_c_t1  <= tmod_i(6);
  s_mode1(1) <= tmod_i(5);
  s_mode1(0) <= tmod_i(4);

  -- These two synchronized signals start the corresponding timer/counter if they are 1.  -- ***
  s_tmr_ctr0_en <= tcon_tr0_i and (not(s_gate0) or s_int0_sync);                          -- *** 
  s_tmr_ctr1_en <= tcon_tr1_i and (not(s_gate1) or s_int1_sync);                          -- *** 

  -- The outputs of this unit are the two timer overflow flags, which are read
  -- by the control unit and the two 16 bit count registers to enable read
  -- access.
  tf0_o <= s_tf0;
  tf1_o <= s_tf1;
  th0_o <= std_logic_vector(s_count0(15 downto 8));
  tl0_o <= std_logic_vector(s_count0(7 downto 0));
  th1_o <= std_logic_vector(s_count1(15 downto 8));
  tl1_o <= std_logic_vector(s_count1(7 downto 0));

-------------------------------------------------------------------------------
  -- The two interrupt inputs are synchronized.   *** 

  p_sync_inputs: process (clk, reset)          -- *** 
    
    begin                                      -- ***

      if reset = '1' then                  -- ***
        s_int0_sync <= '0';                -- ***
        s_int1_sync <= '0';                -- ***
      else                                 -- ***
        if clk'event and clk='1' then      -- ***
          s_int0_sync <= int0_i;           -- ***
          s_int1_sync <= int1_i;           -- ***
        end if;                            -- ***
      end if;                              -- ***

  end process p_sync_inputs;               -- ***

-------------------------------------------------------------------------------
  -- The register s_pre_count is driven with the system clock. So a
  -- good enable signal (which is stable when clk has its rising edge) can be
  -- derived to mask out every twelfth pulse of clk.                                  ***

  s_count_enable <= '1' when s_pre_count = conv_unsigned(11,4) else '0';           -- ***
  
  p_divide_clk: process (clk, reset)
    
    begin

      if reset = '1' then
        s_pre_count <= conv_unsigned(0,4);
      else
        if clk'event and clk='1' then
	  if (s_pre_count = conv_unsigned(11,4)) then                              -- ***
            s_pre_count <= conv_unsigned(0,4);                                     -- ***
	  else                                                                     -- ***
	    s_pre_count <= s_pre_count + conv_unsigned(1,1);                       -- ***
	  end if;
        end if;
      end if;    

  end process p_divide_clk;

-------------------------------------------------------------------------------
  -- The two flip flops are updated every second clock period.
  -- If a falling edge
  -- on the port t0_i is dedected the signal s_ext_edge0 is set to 1 and with
  -- the next rising edge of clk the counter0 is incremented.
  -- The same function is realised for counter1.
  s_ext_edge0 <= '1' when (s_t0ff1 = '0' and s_t0ff2 = '1') else '0';      

  p_sample_t0: process (clk, reset)
      
    begin

      if reset = '1' then
        s_t0ff0 <= '0';
        s_t0ff1 <= '0';
        s_t0ff2 <= '0';
      else
            
        if clk'event and clk = '1' then
          if s_pre_count = conv_unsigned(6,3) then
            if s_c_t0 = '1' then
              s_t0ff0 <= t0_i;
              s_t0ff1 <= s_t0ff0;
              s_t0ff2 <= s_t0ff1;
            end if;
          end if;
        end if;  
      end if;    

  end process p_sample_t0;
      
  s_ext_edge1 <= '1' when (s_t1ff1 = '0' and s_t1ff2 = '1') else '0';

  p_sample_t1: process (clk, reset)
      
    begin

      if reset = '1' then
        s_t1ff0 <= '0';
        s_t1ff1 <= '0';
        s_t1ff2 <= '0';
      else
        if clk'event and clk = '1' then
          if s_pre_count = conv_unsigned(6,3) then
            if s_c_t1 = '1' then
              s_t1ff0 <= t1_i;
              s_t1ff1 <= s_t1ff0;
              s_t1ff2 <= s_t1ff1;
            end if;              
          end if;
        end if;  
      end if;    

  end process p_sample_t1;

------------------------------------------------------------------------------
--+++++++++++++++++++++   TIMER / COUNTER 0   ++++++++++++++++++++++++++++++--
------------------------------------------------------------------------------
-- This is timer/counter0. It is built around the 16 bit count register
-- s_count0 and realises its four operating modes
------------------------------------------------------------------------------
  s_count0(15 downto 8) <= s_counth0;
  s_count0(7 downto 0) <= s_countl0;
  s_count1(15 downto 8) <= s_counth1;
  s_count1(7 downto 0) <= s_countl1;
      
  p_tmr_ctr: process (clk, reset)
    
  begin

    if reset = '1' then                 -- perform asynchronous reset

      s_countl0 <= conv_unsigned(0,8);
      s_counth0 <= conv_unsigned(0,8);
      s_countl1 <= conv_unsigned(0,8);
      s_counth1 <= conv_unsigned(0,8);
      s_tf1    <= '0';
      s_tf0    <= '0';
        
    else
        
      if clk'event and clk = '1' then
          
-------------------------------------------------------------------------------
-- operating mode 0 (13 bit timer/counter)
-------------------------------------------------------------------------------
      case s_mode0 is
        when "00" =>

        -- This section generates the timer/counter overflow flag0
        if s_tmr_ctr0_en = '1' then
          if s_count_enable = '1' then   
            if s_c_t0 = '0' or (s_ext_edge0 = '1' and s_c_t0 = '1')  then
              if s_count0 = conv_unsigned(65311,16) then                          -- ***
                s_tf0 <= '1';
              else
                s_tf0 <= '0';
              end if;
            end if;
          end if;
        end if;
        
        -- This section generates the low byte register of tmr/ctr0
        if wt_i = "00" and wt_en_i = '1' then
          s_countl0 <= unsigned(reload_i);  
        else
          if s_tmr_ctr0_en = '1' then
            if s_count_enable = '1' then   
              if s_c_t0 = '0' then
                if s_countl0 = conv_unsigned(31,8) then                           -- *** 
                  s_countl0 <= conv_unsigned(0,8);
                else
                  s_countl0 <= s_countl0 + conv_unsigned(1,1);
                end if;
              else
                if s_ext_edge0 = '1' then
                  if s_countl0 = conv_unsigned(31,8) then                          -- *** 
                    s_countl0 <= conv_unsigned(0,8);
                  else
                    s_countl0 <= s_countl0 + conv_unsigned(1,1);
                  end if;
                end if;                  
              end if;
            end if; 
          end if;
        end if;
        
        -- This section generates the high byte register of tmr/ctr0
        if wt_i = "10" and wt_en_i = '1' then
          s_counth0 <= unsigned(reload_i);  
        else
          if s_tmr_ctr0_en = '1' then
            if s_count_enable = '1' then   
              if s_c_t0 = '0' then
                if s_count0 = conv_unsigned(65311,16) then                          -- *** 
                  s_counth0 <= conv_unsigned(0,8);
                else
                  if s_countl0 = conv_unsigned(31,8) then                          -- ***
                    s_counth0 <= s_counth0 + conv_unsigned(1,1);
                  end if;
                end if;
              else
                if s_ext_edge0 = '1' then
                  if s_count0 = conv_unsigned(65311,16) then                       -- *** 
                    s_counth0 <= conv_unsigned(0,8);
                  else
                    if s_countl0 = conv_unsigned(31,8) then                         -- *** 
                      s_counth0 <= s_counth0 + conv_unsigned(1,1);
                    end if;
                  end if;
                end if;                  
              end if;
            end if;
          end if;
        end if;
-------------------------------------------------------------------------------
-- operating mode 1 (16 bit timer/counter)
-------------------------------------------------------------------------------

      when "01" =>

        -- This section generates the timer/counter overflow flag0
        if s_tmr_ctr0_en = '1' then
          if s_count_enable = '1' then   
            if s_c_t0 = '0' or (s_ext_edge0 = '1' and s_c_t0 = '1')  then
              if s_count0 = conv_unsigned(65535,16) then
                s_tf0 <= '1';
              else
                s_tf0 <= '0';
              end if;
            end if;
          end if;
        end if;
        
        -- This section generates the low byte register of tmr/ctr0
        if wt_i = "00" and wt_en_i = '1' then
          s_countl0 <= unsigned(reload_i);  
        else
          if s_tmr_ctr0_en = '1' then
            if s_count_enable = '1' then   
              if s_c_t0 = '0' then
                if s_count0 = conv_unsigned(65535,16) then
                  s_countl0 <= conv_unsigned(0,8);
                else
                  s_countl0 <= s_countl0 + conv_unsigned(1,1);
                end if;
              else
                if s_ext_edge0 = '1' then
                  if s_count0 = conv_unsigned(65535,16) then
                    s_countl0 <= conv_unsigned(0,8);
                  else
                    s_countl0 <= s_countl0 + conv_unsigned(1,1);
                  end if;
                end if;                  
              end if;
            end if; 
          end if;
        end if;
        
        -- This section generates the high byte register of tmr/ctr0
        if wt_i = "10" and wt_en_i = '1' then
          s_counth0 <= unsigned(reload_i);  
        else
          if s_tmr_ctr0_en = '1' then
            if s_count_enable = '1' then   
              if s_c_t0 = '0' then
                if s_count0 = conv_unsigned(65535,16) then
                  s_counth0 <= conv_unsigned(0,8);
                else
                  if s_countl0 = conv_unsigned(255,8) then
                    s_counth0 <= s_counth0 + conv_unsigned(1,1);
                  end if;
                end if;
              else
                if s_ext_edge0 = '1' then
                  if s_count0 = conv_unsigned(65535,16) then
                    s_counth0 <= conv_unsigned(0,8);
                  else
                    if s_countl0 = conv_unsigned(255,8) then
                      s_counth0 <= s_counth0 + conv_unsigned(1,1);
                    end if;
                  end if;
                end if;                  
              end if;
            end if;
          end if;
        end if;


-------------------------------------------------------------------------------
-- operating mode 2 (8 bit timer/counter, autoreloaded from high byte register)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久er热在这里只有精品15| 国产综合色在线视频区| 秋霞电影网一区二区| 国产suv精品一区二区883| 欧美影院精品一区| 日本一区二区三区四区在线视频| 亚洲在线一区二区三区| 成人激情免费视频| 久久网站最新地址| 日韩在线卡一卡二| 91老师国产黑色丝袜在线| 久久久久99精品一区| 美女视频网站黄色亚洲| 欧美网站大全在线观看| 亚洲欧洲色图综合| 成人精品小蝌蚪| 精品少妇一区二区三区日产乱码| 亚洲永久精品国产| 在线日韩一区二区| 一区二区三区四区乱视频| 成人午夜大片免费观看| 国产日产欧美一区二区视频| 三级久久三级久久| 欧美高清视频在线高清观看mv色露露十八| 亚洲欧美日韩国产另类专区| 国产成人精品一区二区三区四区| 欧美v国产在线一区二区三区| 日本网站在线观看一区二区三区| 9191久久久久久久久久久| 亚洲一二三四在线观看| 欧美三级电影一区| 午夜欧美视频在线观看 | 国产精品一二三区| 欧美精品一区二区精品网| 看片的网站亚洲| 精品欧美一区二区在线观看| 国内精品自线一区二区三区视频| 精品国产乱码久久久久久图片| 老司机精品视频导航| 精品国产一区二区三区久久影院 | 日本欧美大码aⅴ在线播放| 9191成人精品久久| 国产又粗又猛又爽又黄91精品| 精品日韩一区二区三区免费视频| 精品一区在线看| 国产拍揄自揄精品视频麻豆| 成人性生交大片免费看中文网站| 欧美韩国日本不卡| 99久久免费国产| 亚洲1区2区3区4区| 日韩欧美一区中文| 国产成人精品三级麻豆| 亚洲品质自拍视频| 69堂国产成人免费视频| 久久国产欧美日韩精品| 国产精品天美传媒沈樵| 欧美亚洲一区二区三区四区| 日本va欧美va精品发布| 国产精品久久夜| 欧美日韩一区二区电影| 久久精品国产网站| 国产精品夫妻自拍| 日韩视频在线你懂得| 成人一区二区三区视频| 同产精品九九九| 国产欧美精品区一区二区三区| 91浏览器打开| 精品制服美女久久| 樱花影视一区二区| 精品免费国产二区三区| 94-欧美-setu| 另类中文字幕网| 伊人一区二区三区| 精品久久久久久久人人人人传媒 | 另类专区欧美蜜桃臀第一页| 中文字幕一区二区三区视频 | 中文字幕一区二区三区在线观看| 91免费国产在线| 久久精品国产999大香线蕉| 亚洲摸摸操操av| 久久久精品tv| 69堂亚洲精品首页| 色香蕉成人二区免费| 国产伦理精品不卡| 蜜臀av在线播放一区二区三区 | 色婷婷av一区二区三区之一色屋| 麻豆成人免费电影| 一区二区三区四区中文字幕| 国产精品色呦呦| 精品国精品国产尤物美女| 欧美日韩国产一级| 白白色 亚洲乱淫| 国产另类ts人妖一区二区| 日韩中文字幕区一区有砖一区| 国产精品久久久久久久蜜臀 | 一区二区欧美国产| 中文字幕av一区二区三区| 日韩精品专区在线影院重磅| 欧美日韩中文国产| 欧美性做爰猛烈叫床潮| 91婷婷韩国欧美一区二区| 成人开心网精品视频| 国产精品一区二区无线| 国产真实精品久久二三区| 青青草原综合久久大伊人精品 | 亚洲国产经典视频| 久久久噜噜噜久久人人看 | 国产精品久久久久久久浪潮网站 | 国产精品夫妻自拍| 中文字幕中文字幕中文字幕亚洲无线| 2024国产精品视频| 久久婷婷一区二区三区| 国产视频不卡一区| 日本一区二区三区国色天香 | 欧美日韩午夜在线| 欧美日本视频在线| 69久久99精品久久久久婷婷| 制服丝袜亚洲播放| 日韩美女在线视频 | 亚洲aaa精品| 日韩av中文字幕一区二区| 蜜桃免费网站一区二区三区| 久久丁香综合五月国产三级网站 | 免费xxxx性欧美18vr| 秋霞午夜鲁丝一区二区老狼| 久久99精品久久久久久国产越南| 激情小说欧美图片| 国产99久久久久久免费看农村| 懂色av噜噜一区二区三区av| av中文字幕在线不卡| 一本色道综合亚洲| 91精品国产综合久久香蕉的特点| 欧美不卡一区二区| 中文字幕av不卡| 亚洲.国产.中文慕字在线| 美腿丝袜在线亚洲一区| 国产成人精品影院| 在线观看区一区二| 欧美一区二区久久久| 国产日韩欧美精品在线| 亚洲视频在线观看三级| 日日摸夜夜添夜夜添国产精品 | 国产在线观看一区二区| 成人免费av资源| 欧美精品一二三| 国产亚洲精品超碰| 亚洲午夜免费视频| 美女视频网站久久| 欧美videossexotv100| 国产午夜亚洲精品理论片色戒| 亚洲精品日日夜夜| 久久电影国产免费久久电影| 99国产精品99久久久久久| 在线播放91灌醉迷j高跟美女| 26uuu国产电影一区二区| 亚洲免费观看高清完整版在线观看 | 日韩女优电影在线观看| 国产精品久久久久久久久果冻传媒| 一区二区三区在线不卡| 国产精品一区一区| 欧美一三区三区四区免费在线看 | 日韩欧美电影在线| 亚洲激情五月婷婷| 国产精品一区二区在线播放| 欧美日韩成人一区二区| 亚洲欧洲精品成人久久奇米网| 欧美96一区二区免费视频| 91论坛在线播放| 欧美激情一区二区在线| 免费精品99久久国产综合精品| 色综合久久88色综合天天6| 国产欧美一区二区三区沐欲 | 欧美电影免费提供在线观看| 亚洲男人的天堂av| 成人国产亚洲欧美成人综合网| 91精品国产乱| 亚洲成人av免费| 色丁香久综合在线久综合在线观看| 欧美精品一区二区三区四区| 男男成人高潮片免费网站| 欧美最猛黑人xxxxx猛交| 国产精品福利电影一区二区三区四区| 久久国产麻豆精品| 91精品国产91久久久久久最新毛片| 亚洲一区二区五区| 91久久香蕉国产日韩欧美9色| 日本一区二区三区四区在线视频| 激情综合色播五月| 日韩三区在线观看| 视频精品一区二区| 欧美精品xxxxbbbb| 亚洲第一精品在线| 欧美日韩欧美一区二区| 亚洲一区二区在线免费观看视频| 一本久久综合亚洲鲁鲁五月天| 亚洲欧洲精品天堂一级 | 久久久精品国产免大香伊| 九九在线精品视频| 欧美本精品男人aⅴ天堂| 久久成人18免费观看|