📄 host.vhd
字号:
---------------------------------------------------------------------------- Copyright (C) 1998-1999, Annapolis Micro Systems, Inc.-- All Rights Reserved.------------------------------------------------------------------------------------------------------------------------------------------------------ Entity : Host---- Architecture : Mem_Copy---- Filename : host_mem_copy_arch.vhd---- Date : 9/3/99---- Description : This host program is used to write/read values -- to/from the PE1 on-board memories.--------------------------------------------------------------------------------------------------------- Glossary ----------------------------------- Name Key:-- =========-- _AS : Address Strobe-- _CE : Clock Enable-- _CS : Chip Select-- _DS : Data Strobe-- _EN : Enable-- _OE : Output Enable-- _RD : Read Select-- _WE : Write Enable-- _WR : Write Select-- _d[d...] : Delayed (registered) signal (each 'd' denotes one -- level of delay)-- _n : Active low signals (must be last part of name)---- Port Name Width Dir Description-- ==================== ===== === ================================-- Cmd_Req 1 O Command request flag-- Cmd_Ack 1 I Command acknowledge flag---------------------------------------------------------------------------------------------------- Library Declarations ------------------------library SYSTEM;use SYSTEM.Host_Package.all;------------------------ Architecture Declaration ----------------------architecture Mem_Copy of Host isbegin -------------------------------------------------------- -- -- Below is an example of how to use host "API" -- functions to send commands to the WILDSTAR(tm) -- board. Copy this file to your project directory -- and modify it to simulate the behavior of the -- host portion of your application. -- -------------------------------------------------------- main : process -------------------------------------------------------------------- -- -- Below are variables used by the simulated host API functions. -- Simply uncomment the variable(s) that are needed by the API -- functions. All other unused variables may remain commented -- out. -- -------------------------------------------------------------------- variable board : WS_BoardNum := 0; variable enable : boolean := FALSE; variable memInitFile : string ( 1 to 12 ) := "mem_init.dat"; variable memDumpFile : string ( 1 to 12 ) := "mem_dump.dat"; variable memBank : Mem_Bank_Type; variable mClkSource : WS_CLOCK_SOURCE := PROG_OSCILLATOR; variable mClkFreq : float := 50.0; variable pClkDivisor : DWORD := 1; variable uClkSource : WS_CLOCK_SOURCE := PROG_OSCILLATOR; variable uClkFreq : float := 50.0; variable peNum : DWORD; variable dwordOffset : DWORD; variable dwordCount : DWORD; variable memData : DWORD_array ( 0 to 255 ); variable regData : DWORD_array ( 0 to 255 ); variable Done : boolean; begin -- -- At first, deassert the command request signal -- Cmd_Req <= FALSE; -------------------------------------------------------------------- -- -- Below are example simulated host API function calls. Simply -- uncomment the function(s) that are needed by the application. -- All other unused function calls may remain commented out. Be -- sure to uncomment any variables used by the API functions. -- -------------------------------------------------------------------- -- -- Print the version of the VHDL model -- Debug_Print_Version( Cmd_Req, Cmd_Ack ); -- -- We are using board 0 -- board := 0; --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Step 1 : Initialize the simulated on-board memories. Note -- that we use the shortcut "debug" functions to do this -- since it would take too long to do it over the LAD -- bus. -- --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Load memory banks from file, where memBank -- can be one of the following: -- -- PE1_LEFT_MEM_BANK -- PE1_RIGHT_MEM_BANK -- PE1_LEFT_MEZZ_MEM0_BANK -- PE1_LEFT_MEZZ_MEM1_BANK -- PE1_RIGHT_MEZZ_MEM0_BANK -- PE1_RIGHT_MEZZ_MEM1_BANK -- memBank := PE1_LEFT_MEM_BANK; Debug_Load_Mem_From_File ( Cmd_Req, Cmd_Ack, "mem_init.dat", board, memBank ); memBank := PE1_RIGHT_MEM_BANK; Debug_Load_Mem_From_File ( Cmd_Req, Cmd_Ack, "mem_init.dat", board, memBank ); --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Step 2 : Configure the memory clock and processing element -- clock. -- --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Set up M_Clk and P_Clk, where mClkSource -- can be PROG_OSCILLATOR, EXT_IO_0, EXT_IO_1, -- or BACK_PLANE and pClkDivisor can be from 1 -- to 16. -- mClkSource := PROG_OSCILLATOR; mClkFreq := 80.0; pClkDivisor := 8; uClkFreq := 5.0; uClkSource := PROG_OSCILLATOR; WS_MClkSetConfig ( Cmd_Req, Cmd_Ack, board, mClkSource, mClkFreq, pClkDivisor ); WS_UClkSetConfig ( Cmd_Req, Cmd_Ack, board, uClkSource, uClkFreq ); --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Step 3 : Reset each of the PEs by writing to their reset -- registers that are mapped to LAD bus register space -- DWORD address 0x01000 in their respective PEs. -- --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Reset the PE1 device -- peNum := WS_PE1; dwordOffset := 16#00000800#; -- Reset register dwordCount := 1; regData(0) := 1; WS_WritePeReg ( Cmd_Req, Cmd_Ack, board, peNum, dwordOffset, dwordCount, regData ); assert FALSE report "============ All PEs are now reset ============" severity NOTE; --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- -- Step 4 : Write 256 words to PE1's left on-board memory, -- starting at address 0. This is accomplished by -- performing the following tasks: -- -- 1. Set the memory mux select to the host setting. -- 2. Fill the block RAM buffer with the data that is -- to be written to the memory. -- 3. Send a set of control words to the buffer -- control logic that sets the block RAM buffer -- offset, memory address, write command, and -- DWORD count. -- 4. Check the status register to determine when -- the write operation has completed. -- -- --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -------------------------------------------------------------------- -- -- Select the host to be connected to the memories -- -------------------------------------------------------------------- peNum := WS_PE1; dwordOffset := 16#00000900#; -- Control register for PE1 dwordCount := 1; regData(0) := 16#00000001#; -- Bit 0 Host/App WS_WritePeReg ( Cmd_Req, Cmd_Ack, board, peNum, dwordOffset, dwordCount, regData ); -------------------------------------------------------------------- -- -- Fill up the block RAM with data to be written to memory. -- -------------------------------------------------------------------- --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- -- This is the ARM Program. -- --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! peNum := WS_PE1; dwordOffset := 16#00000100#; -- Block RAM for Mem --Program Length (dwordCount = # of instructions) --If greater than 256 must repeat section from here to END REPEAT dwordCount := 209; memData(0) := 16#e2000000#; memData(1) := 16#e2011000#; memData(2) := 16#e2022000#; memData(3) := 16#e2033000#; memData(4) := 16#e3800001#; memData(5) := 16#e3801002#; memData(6) := 16#e0802001#; memData(7) := 16#e241100a#; memData(8) := 16#e2522001#; memData(9) := 16#1afffffc#; memData(10) := 16#eb000027#; memData(11) := 16#eb000042#; memData(12) := 16#e3a0dffa#; memData(13) := 16#eb000051#; memData(14) := 16#eb00006d#; memData(15) := 16#eb000039#; memData(16) := 16#eb000076#; memData(17) := 16#eb000003#; memData(18) := 16#e3a0dffa#; memData(19) := 16#eb00009e#; memData(20) := 16#eb0000a9#; memData(21) := 16#ebfffffe#; memData(22) := 16#e3a000ff#; memData(23) := 16#e3a01caa#; memData(24) := 16#e1800001#; memData(25) := 16#e3a01855#; memData(26) := 16#e1800001#; memData(27) := 16#e3a01801#; memData(28) := 16#e0c100b2#; memData(29) := 16#e5116002#; memData(30) := 16#e3866000#; memData(31) := 16#e0c160b2#; memData(32) := 16#e5117004#; memData(33) := 16#e15120b2#; memData(34) := 16#e15130f2#; memData(35) := 16#e15140d2#; memData(36) := 16#e15150d1#; memData(37) := 16#e2411004#; memData(38) := 16#e5810000#; memData(39) := 16#e2811001#; memData(40) := 16#e5919000#; memData(41) := 16#e2811001#; memData(42) := 16#e5919000#; memData(43) := 16#e2811001#; memData(44) := 16#e5919000#; memData(45) := 16#e2411002#; memData(46) := 16#e5810000#; memData(47) := 16#e5919000#; memData(48) := 16#e2411001#; memData(49) := 16#e5919000#; memData(50) := 16#e1a0f00e#; memData(51) := 16#e3f00000#; memData(52) := 16#e2900001#;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -