In order to test the implementation of AVR, a simple program was designed that could
be used to exercise the paths. The general purpose of this program was to load data from an
external memory, manipulate that data through ALU and then change the register file contents.
Resultant values could be observed by the register file. Table2 shows a typical sequence of
execution of instructions.
Table 2.Sequence of instruction execution
There are instances in the execution of a number of instructions in AVR that requires the concurrent access of the register file or other such logic. As AVR has not been designed to function in a concurrent manner, e.g. only sequential processing of instructions can occur in any stage; even with the modified micropipeline structure was introduced.
The obvious conclusions from above statements are that there are likely to be a large performance compromise but rather as a prototype device to investigate how existing tools could cope with such a task.
The AVR test program along with a number of other numeric constants, e.g. values representing the data that would be actually found in the external memory, has been connected to the AVR. The general configuration of this external logic with the associated connectivity can be seen in Figure 21, and introduced below.
Figure21. Testing configuration
4.1 Testing configuration introduction
In Figure 21, the right block represents the asynchronous AVR. In order to observe the register contents, we extend the general-purpose register R31 data to outside, named OUTPUT, as you can see in the right part of the asynchronous AVR. We connect a LED to its
OUTPUT port to indicate the register content. The left upper block is used for controlling the testing procedure and it receives a 50 MHz signal to internal timing. When this control block detects the reset signal (active low), the minimum 20ms reset signal will send into the asynchronous chip to ensure the internal register situation from the sim_clr port.
Sim_req request event signal arise later to start the first instruction operation. The AVR feedback the acknowledgement events to control block after complete inner operation. The low Sim_req request event signal response the acknowledgement from AVR. The request and acknowledgement situation are idled when transaction is fully completed. The next instruction repeat the procedure described above around.
The instruction fetch stage of AVR will send out an EPROM Enable signal and address signal. Due to the characteristic of the EPROM 2764 active low enable signal is different from the AVR active high enable signal and the voltage level transformation is needed. The instruction code generated from EPROM pass through the one rail to two rail circuits where transfer the single rail Instruction code to the dual–rail instruction code and finally, to the AVR microcontroller.
4.2 16 bits instruction composition
The type of EPROM unit employed was an 8K MD2764 device with 8-bit addressing. In order to present the 16-bits instruction or data value to an AVR instruction input, two of these devices would be enabled in parallel in order to construct that 16-bit word. The structural organization of these EPROM units is shown in Figure 22.
Figure22. EPROM 16-bit word configuration
4.3 Memory interface
In order to connect to synchronous components, some modification must be inserted to meet synchronous requirement to assure the correct function, and introduced below.
4.3.1 Dual-rail to single-rail circuit
The internal register in our AVR is designed for dual rail format. Every data-bit in dual rail format is represented by two one-bit latches. The address data provided from the NPC register is positive part of dual rail data. Furthermore, the EPROM strobe signal is provided by the combination of dual rail address data. The combination organization is constructed by the Muller-C circuits. The strobe signal is guaranteed to be late to the address data which the EPROM output the correct instruction code. Figure23 illustrates that the two-rail data constructs the strobe signal with Muller-C circuits and Y signal is directed from the positive
part of the dual rail X data. More details can be found in [13].
Figure23. Two Rails to One Rail Circuit
4.3.2 Single-rail to dual-rail circuit
The instruction register is dual-rail format. The instruction code generated from EPROM must pass through the one-rail to two-rail circuits. The differential line driver IC (AM26LS31) is used to the transformation circuits. Figure24 illustrates that the two bit single-rail data is transferred to two dual-rail data. The strobe signal is used to control the dual-rail format data.
The Z data is valid with the strobe signal is high. The Z condition is high impedance with the strobe signal is low. More details can be found in [13].
Figure24. One-rail to two-rail circuit
4.3.3 Return to zero circuits
The ultimate condition of four-phase handshake protocol is that request and acknowledgement signals are set to the idle (L) condition. To achieve the rule standard, the extra circuits are needed. We connect the return to zero circuits to the output of the single-rail to dual-rail circuits output. The handshake between instruction fetch stage and EPROM is ended with the strobe signal is low. The single-rail to dual-rail circuits output condition is high impedance with the strobe signal is low. The dual-rail data is low with the return to zero circuits because of the electronic rules. It meets the four-phase return to zero handshake protocol. Figure 25 illustrates the return to zero circuits.
Figure25. Return to zero circuits
4.4 HDL verification
The Modelsim software is used to simulate the system level behaviors of AVR and verify the AVR instruction set function. Figure26 illustrates a looping addition function.
The clr signal is send from outside to reset the internal condition in AVR. The req_AIC is send from outside to start an instruction procedure. After AVR finished one instruction, it sends acknowledgement ack_AIC signal outside. The EPROM_AD and EPROM_ENABLE are issued from instruction fetch stage to outside EPROM. Its feedback instruction data in
dual-rail format are INSTR_Id0 and INSTR_Id1.The REG_31_OUT is the register 31 contents.
After receiving the reset signal, the contents of the register R31 are cleared to zero. The contents are updated the first instruction executed. And it decrease one after the ADD instruction (INSTR_id1 =0ffe) executed. The REG_31_OUT is complement format to match up the outside LED circuits.
Figure26. Simulation result in Modelsim SE/EE PLUS 5.4
4.5 Physical circuits’ validation
The simulation software is used to verify the hardware behaviors. The verified design is downloading to the physical circuits to check the function. Table3 show the test program.
MEMORY ADDRESS ASSEMBLY CODE Description
000000 LDI R31 , 0 R31 = 0
000001 LDI R30 , 1 R30 = 1
000010 ADD R31 , R30 R31 = R31 + R30
000011 JMP 00000010 Branch to 00000010
Table 3. The test program of looping addition
We can validate the physical circuits with our downloading design by observing the LED status. The correct function of the physical circuits has the following meanings. First, the software simulation is reliable with the delay insensitive model. Second, peripheral device with the protocol transformation circuits are also working correctly. Finally, it proves correctness of the design methodology we described. Figure27, Figure28 illustrates the physical circuits. The Xilinx prototype board in Figure 27 comprises Virtex E FPGA Chip which used to implement the AVR microcontroller core and control procedure circuits. The I/O Card in Figure 28 comprises the EPROM, Memory interface, Output LED and Remote RESET button.
Figure27. Xilinx prototype board with Virtex E FPGA Chip
Figure28. I/O Card