SAP computer之program counter

來源:互聯網
上載者:User

標籤:

  Program counter

  The program is stored in memory with the first instruction at binary address 0000, the second instruction at address 0001, the third at address 0010 and so on.  The program counter, which is part of the control unit, counts from 0000 to 1111. Its job is to send to the memory the address of next instruction. 

  The program counter is reset to 0000 before computer run. When the computer run begins, the program counter sends address 0000 to the memory. The program counter is then incremented to get 0001. After the first instruction is fetched and executed, the program counter sends address 0001 to the memory. Again the program counter is incremented. After the second isntruction is fetched and executed, the program counter sends address 0010 to the memory. In this way, the program counter is keeping track of the next instruction to be fetched and executed.

  The program counter is like someone pointing at a list of instruction, saying do this first, do this second, etc. This is why the program counter is sometimes called a pointer; it points to an address in memory where something important is being stored.

 

 1 library IEEE; 2 use ieee.std_logic_1164.all; 3 use ieee.std_logic_unsigned.all; 4  5 entity PC is 6 port  7 (     8     ep    : in  std_logic;                     --! Active high output enable from PC, or tri-state 9     clr    : in  std_logic;                     --! Active high asynchronous clear10     clk    : in  std_logic;                     --! Falling edge clock11     cp    : in  std_logic;                     --! Active high enable PC to count12     q     : out std_logic_vector(3 downto 0)   --! 4-bit PC output13 );    14 end PC ;15 16 architecture beh of PC is17 18 signal count : std_logic_vector(3 downto 0);19 20 begin21 22 process (clr,ep,cp,clk,count)23 begin24     if clr = ‘1‘ then25         q <= "0000";26         count <= "0000";27     elsif cp = ‘1‘ then28          if (clk‘event and clk = ‘0‘) then29             if count < "1111" then count <= count + 1;30             else count <= "0000";31             end if;32         end if; 33      end if;34     35     if ep = ‘0‘ then 36         q <= "ZZZZ";37     else        38         q <= count;39     end if;40 41 end process; 42 43 end beh;

 

SAP computer之program counter

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.