Summary of the invention:
The technical problem to be solved in the present invention is: at the needs that need to articulate and visit multiple storer in the built-in applied system, a kind of method that the multiple storer that is articulated on the outer unibus of sheet is conducted interviews is proposed, embedded microprocessor can be conducted interviews to being articulated in the outer multiple storer of sheet by unibus, overcome traditional employing multibus and visit the deficiency of multiple memory approach, reduce the power consumption and the area of this class microprocessor, reduce the pin number.
Technical scheme is that the memory access address realm is divided into the M sub spaces, the corresponding a kind of storer in each subspace.A kind of unibus memory interface of design is provided with the M silver and selects signal on interface in embedded microprocessor, and each chip selection signal connects a kind of storer.The inner integrated decoding unit of memory interface, control register group, M kind memory controller and a cross bar switch, realization is to the configuration of each memory parameter, the decoding of chip selection signal and the generation of bus signals, realizes the target that the M kind storer that articulates simultaneously on the unibus is conducted interviews by the selection to bus signals.
Concrete technical scheme is:
At first the memory access address realm is divided.If external bus articulates M kind storer simultaneously, then whole memory access address realm is divided into the M sub spaces, the corresponding storer in each subspace.When dividing the subspace, address, begin to divide from the MSB (Most Significant Bit, highest significant position) of address.If the capacity difference of each storer, each sub spaces of being divided varies in size, and promptly carries out inhomogeneous division; If total address realm is enough big, after evenly being divided into the M sub spaces, the size of each subspace can both satisfy the capacity of respective memory, then evenly divides, be about to total address realm and evenly be divided into the M sub spaces, be convenient to decoding unit like this and decipher.Wherein M is the integer more than or equal to 1.
The method for designing of unibus memory interface is: it is made up of decoding unit, control register group, M kind memory controller, cross bar switch.Decoding unit links to each other with cross bar switch with DMA, control register group, memory controller, receive the controlled variable of memory access request signal, address signal and the control register group of DMA, the memory access solicited message is deciphered, produce M chip selection signal and export to cross bar switch, the read/write start up command signals of generation and read-write number of times signal are exported to memory controller; The control register group connects by configuration bus and the CPU nuclear phase of CPU, accepts the configuration that CPU checks various memory parameter, and sends controlled variable to decoding unit and memory controller; The controlled variable signal of read/write command that data-signal, address signal, the decoding unit of memory controller reception DMA memory access produces and read/write number of times signal, control register group, produce required data of read/write respective memory and control signal (address, read/write enable, output enable etc.), and these signals are delivered to cross bar switch, the number of memory controller is consistent with the storer kind, if the storer kind is M, then the number of memory controller also is M.Cross bar switch internally connects the M silver and selects signal and M the bus signals that memory controller produces, and externally articulates M kind storer by the outer unibus of sheet.
Decoding unit is made of chip selection signal decoding module, read/write signal decoding module and read-write number of times decoding module.Select signal owing to comprise the M silver on the memory interface, each chip selection signal connects a kind of storer, therefore when the chip selection signal decoding module is deciphered the high position of DMA memory access address, judge the subspace that this address is affiliated, activate in the corresponding M chip selection signal then, be used to choose corresponding memory on the outer unibus of sheet; The read/write signal decoding module is deciphered according to a high position and the memory access request of memory access address, judges the storer that will read and write, sends corresponding read/write start up command signals and gives corresponding memory controller, starts the read/write processes of memory controller.The memory width parameter that read-write number of times decoding module is sent here according to memory access data width and control register group is deciphered, and produces read/write number of times signal.If the data width of memory access is greater than the memory width that has disposed in the corresponding control register, read/write number of times signal will be used to indicate the operation of respective stored controller greater than 1.For example, the data width of certain read request is 32, and the width of corresponding stored device has only 16, so decoding unit will decipher produce size be 2 read the number of times signal, memory controller will be according to this signal, from 2 continuous addresses of respective memory, respectively read 16 bit data, be merged into 32 data, return to DMA.If the maximal value of memory access data width is S times of minimum widith in M the memory width, S is 2 integral number power, and the width of read/write number of times signal should be made as log so
2The S position.
The control register group comprises decoding scheme and M group control register, comprise several registers in every group of control register, be used to dispose a kind of controlled variable of storer, foundation/triggering/retention time of the width of storer and type, asynchronous memory for example, the row/row of SDRAM storer/parameters such as body number of addresses.The type of parameter and number are according to the needs increase and decrease of actual storage.If the required controlled variable of certain storer is less, use a control register can represent all parameters, only a control register need be set in the control corresponding registers group so.If must use a plurality of control registers could represent all controlled variable, need to be provided with a plurality of control registers in the control corresponding registers group so.The bit wide of each control register is traditionally arranged to be the word length of microprocessor, simultaneously corresponding global logic address.CPU carries out read/write by configuration bus to the controlled variable of each control register.When read/write, decoding scheme is deciphered read/write address, the read/write command sent here on the configuration bus, produces the command signal of the corresponding control register of read/write.Control register is accepted the command signal of decoding scheme: if the write parameters order, then the data of sending here on the configuration bus are write the respective field of register; If read parameter command, then the data of own respective field are outputed on the configuration bus, provide ready for data signal simultaneously.Every kind of memory controller adopts disclosed standard design method in the memory interface.The read/write startup command that decoding unit produces only activates a kind of controller of storer at every turn, and remaining memory controller can not respond.The memory controller that is activated produces required valid data and the control signal of read/write respective memory, and data and control signal that remaining memory controller produces are invalid.
Cross bar switch is a group selection logical circuit, is made of M road multi-selection device.Data and control signal that it is sent here each memory controller according to M chip selection signal are carried out multiselect one operation.If (1≤i≤M) individual chip selection signal is effective, and data and the control signal of then selecting i memory controller (memory controller that promptly is activated) to produce output on the external bus, also export M chip selection signal simultaneously for i.
Utilize above-mentioned memory interface to the method that a plurality of storeies that are articulated on the outer unibus of sheet conduct interviews to be: before the beginning memory access, CPU writes the control register group by configuration bus with the controlled variable of various storeies.When memory access, decoding unit is deciphered memory access address, memory access request and memory access data width according to the controlled variable that the control register group provides, activation M silver selects in the signal, produces effective read/write start up command signals and read/write number of times signal simultaneously, exports to memory controller.Because wherein a kind of storer is only visited in each memory access, therefore have only the read/write startup command of a corresponding decoded unit of memory controller to activate, remaining memory controller does not respond.The memory controller that is activated produces the data and the control signal that meet the requirement of respective memory sequential according to memory access data, address and controlled variable, exports to cross bar switch.Cross bar switch selects signal according to the M silver, and data and the control signal of selecting the respective stored controller to produce output on the external bus.Signal on the memory response external bus that the effective chip selection signal of quilt is chosen is finished accessing operation.Other storeies of not chosen by chip selection signal are the response external bus signals not.So just realized target that the multiple storer that articulates simultaneously on the unibus is conducted interviews.
The kind of increase/minimizing storer needs only increase/minimizing control corresponding register, chip selection signal, memory controller and switch and selects logic if desired.
Adopt the present invention can produce following beneficial technical effects:
1. the multiplexing cover external bus of all storeies reduces the chip pin number under the original multibus mode, has reduced chip power-consumption and area;
2. according to the needs of different application to the storer kind, the present invention is with good expansibility and tailorability:
3. the present invention adopts the module interface of standard, has module reuse preferably.
Embodiment:
Fig. 1 is a general embedded microprocessor application system.Microprocessor internal is integrated a kind of memory interface of the present invention.In this example, SDRAM, SBSRAM, FIFO, Flash totally 4 kinds of different storeies have been articulated on the memory interface external bus simultaneously.
Fig. 2 is the building-block of logic that articulates the unibus memory interface of SDRAM commonly used, SBSRAM, FIFO, four kinds of storeies of Flash.This unibus memory interface is made up of decoding unit, control register group, 4 memory controllers, cross bar switches.Decoding unit receives the memory access request signal of DMA, and the control register group connects the configuration bus of CPU, and cross bar switch connects four kinds of storeies by the outer unibus of sheet.Before the beginning memory access, CPU writes the control register group by configuration bus with the controlled variable of four kinds of storeies.When memory access, decoding unit is deciphered memory access address, memory access request and memory access data width according to the controlled variable that the control register group provides, activate 4 silvers and select in the signal one, produce effective read/write start up command signals and read/write number of times indicator signal simultaneously, export to memory controller.Because wherein a kind of storer is only visited in each memory access, therefore have only the read/write startup command of a corresponding decoded unit of memory controller to activate, remaining memory controller does not respond.The memory controller that is activated produces the data and the control signal that meet the requirement of respective memory sequential according to memory access data, address and controlled variable, exports to cross bar switch.Cross bar switch is four to select a logic, and it selects signal according to 4 silvers, and data and the control signal of selecting one of them memory controller to produce output on the external bus.Signal on the memory response external bus that the effective chip selection signal of quilt is chosen is finished accessing operation.
Fig. 3 has provided the composition structure of decoding unit of the present invention.This figure is an example with four kinds of storeies of SDRAM, SBSRAM, FIFO, Flash commonly used still.Suppose that the memory access address size is the n position, and after being divided into 4 sub spaces, just can distinguish 4 sub spaces according to n position and n-1 bit address, " chip selection signal decoding " module can realize with a 2-4 code translator, the chip selection signal of 4 storages of decoding output." read-write decoding " module through decoding, produces the read/write start up command signals of 4 storeies according to n position and n-1 bit address and read signal.The memory width parameter that " read-write number of times decoding " module is sent here according to memory access data width signal and 4 control registers is deciphered, and produces read/write number of times signal, is used to indicate the read-write process of memory controller.The maximal value of supposing the memory access data width is S times (S generally is 2 integral number power) of minimum widith in 4 memory widths, and the width of read/write number of times signal should be made as log so
2The S position.The maximal value of for example memory access data width is 64, and external storer minimum widith is 8 bit wides, and S equals 8 so, and the width of read/write number of times signal should be made as 3.
Fig. 4 has provided the building-block of logic of control register group of the present invention.Be example with four kinds of storeies of SDRAM, SBSRAM, FIFO, Flash commonly used still, the control register group is made of decoding scheme and four groups of control registers.Example among the figure comprises four groups of control registers, and provided respectively organize control register the specific field structure, be respectively applied for the configuration SDRAM, SBSRAM, FIFO and Flash controlled variable.Wherein R1 is the control register group of configuration SDRAM controlled variable, wherein comprises 2 32 register, be respectively applied for configuration burst mode, CAS response beat, refresh enable, controlled variable such as refresh cycle.R2 is the control register group of SBSRAM, wherein only comprises 1 32 register.R3 is the control register group of FIFO, and R4 is the control register group of Flash, all has only one 32 control register respectively.Control register is divided into a plurality of fields, and each field is used to be provided with a parameter, and the length of field is decided according to the complex situations of parameter.If this parameter has n kind situation, the required figure place B of this field should satisfy so
If the controlled variable of certain storer is more, use the control register can't perfect representation, can dispose a kind of parameter of storer so with a plurality of control registers.The R1 group that is used for disposing the SDRAM parameter among Fig. 4 has just been used 2 control registers.Each control register all has a global address, and CPU can carry out read/write to the controlled variable of each control register by configuration bus.When read/write, decoding scheme is deciphered read/write address, the read/write command sent here on the configuration bus, produces the command signal of the corresponding control register of read/write.Control register is accepted the command signal of decoding scheme: if the write parameters order, then the data of sending here on the configuration bus are write the respective field of register; If read parameter command, then the data of own respective field are outputed on the configuration bus, provide ready for data signal simultaneously.
Fig. 5 has provided memory interface of the present invention articulates the Flash of the SDRAM of one 32 bit wide and one 16 bit wide simultaneously by external bus synoptic diagram.
The present invention at present adopts in 32 high performance float-point DSP " milky way is soared-DSP700 " that University of Science and Technology for National Defence develops voluntarily, and this DSP can articulate 4 kinds of different storeies on the unibus simultaneously outside sheet.