A kind of AT96 bus controller IP kernel based on FPGA
Technical field
The utility model relates to the communication class veneer by the interconnected application of AT96 bus interface, relates in particular to a kind of AT96 bus controller IP kernel based on FPGA, belongs to communication apparatus design and applied technical field.
Background technology
For AT96 bus PC is applied in the abominable industrial environment, initiated to have formulated AT96 bus Eurocard standard (IEEE996) by German SIEMENS company in 1994, and obtained applying in Europe.AT96 bus=AT96 bus electrical code+96 core pin hole connector+Eurocard standards (IEC297/IEEE 1011.1).The edge golden finger that AT96 bus industrial computer has been eliminated between the template connects, and has anti-strong motion and impact capacity; Its 16 bit data bus, 24 bit addressing abilities, high reliability and good maintainability are more suitable for using in abominable industrial environment.Abroad, AT96 bus industrial computer is more complete, and 80386,80486 products are arranged, and the PENTIUM series of products are also arranged, and supports high speed ETHERNET network interface.Because the AT96 bus has above-mentioned superiority, the AT96 bus begins to be widely used in industries such as automatic control, data transmission set, medicine equipment.These equipment must design the AT96 bus controller in order to support the function of AT96 bus access on equipment.Traditional AT96 bus controller all is based on asic chip, and its advantage is that hardware design is convenient, needn't consider that the inside of AT96 bus protocol is realized.But it is higher that shortcoming is a cost, and portable poor, configuration operation is loaded down with trivial details, and application efficiency is not high.Therefore, it is necessary designing the AT96 bus controller that a portability is strong, configuration operation is simple, application efficiency is high and cost is less, herein disclosed is a kind of design and implementation method of the AT96 bus controller IP kernel based on FPGA.
The utility model content
1) utility model purpose:
Existing AT96 bus controller major part designs based on asic chip, and its design is complicated, portable poor, and configuration operation is loaded down with trivial details, and application efficiency is not enough, and cost is higher.The purpose of this utility model is the shortcoming that has now based on the AT96 bus controller of asic chip in order to overcome, a kind of AT96 bus controller IP kernel and construction method thereof based on field programmable gate array (being FPGA) is provided, its configuration is simple, portable strong, the AT96 bus protocol is finished by FPGA hardware fully, reduce the load of CPU, reduced application cost simultaneously greatly.
2) technical scheme:
1, a kind of AT96 bus controller IP kernel of the utility model based on FPGA, it is made up of AT96 bus interface module (001), AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004), local bus interface's module (005) and functional configuration module (006), as shown in Figure 2, position annexation between them and signal flow are to as described below:
AT96 bus interface module (001) one end is connected on the AT96 bus interface card, the other end is connected with AT96 bus controller state machine module (002), AT96 bus controller state machine module (002) is connected on the FIFO cache module (003), FIFO cache module (003) is directly connected to local bus control module (004), and local bus control module (004) is connected to local bus interface's module (005), functional configuration module (006) and AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004) and local bus interface's module (005) all have connection.
A) AT96 bus interface module (001) one end is connected on the AT96 bus interface card, the other end is connected to AT96 bus controller state machine module (002), its receive from data on the AT96 bus and control signal or send data and control signal on the AT96 bus;
B) AT96 bus controller state machine module (002) is the control core of entire I P nuclear, and it adopts finite state machine FSM to realize the AT96 bus timing of AT96 bus protocol regulation and the reception or the control of transmission buffer memory of data.AT96 bus controller state machine module (002) is connected on the FIFO cache module (003), is controlled data and the control signal data that buffer memory receives in FIFO cache module (003) or read the data and the control signal data that will send from FIFO cache module (003) by AT96 bus controller state machine module (002);
C) FIFO cache module (003) is used for the handoff functionality in AT96 bus clock territory and local bus clock territory, it is directly connected to local bus control module (004), is read the data and the control signal of reception or deposits the data and the control signal that will send on the AT96 bus in from FIFO cache module (003) by local bus control module (004) control;
D) local bus control module (004) is connected to local bus interface's module (005), and local bus interface's module (005) is to realize the translation function of FPGA internal bus interface and cpu i/f;
E) functional configuration module (006) all has with AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004) and local bus interface's module (005) and is connected, major function is the parameter of configuration AT96 bus controller IP kernel, and mode of operation, interruption detection mode, principal and subordinate's switching and the indication running state information of AT96 bus controller IP kernel is set.
Described AT96 bus interface module is made up of the inputoutput buffer IOB of FPGA inside, comprise input buffer (Input Buffer), output buffer (Output Buffer), input and output bidirectional buffer (InOut Buffer) and 3 attitude impact dampers (Tri-State Buffer), they interconnect each other.The AT96 bus interface module is mainly finished the mutual translation function of the signal level of FPGA inside and the signal level that the AT96 bus protocol is stipulated and the function that realizes the transmitted in both directions port in the AT96 bus signals.
The finite state machine (FSM) that described AT96 bus controller state machine module is realized by the FPGA internal logic is formed, this finite state machine is under the beat of clock, according to control signal that is input to state machine and outside status signal, realize the redirect between each status function, under different conditions, the control signal and the indicator signal of state machine output corresponding function.The FIFO buffer module is finished Data Receiving, transmission and caching function according to the control signal and the indicator signal of state machine output.
Described FIFO cache module be by the look-up table of FPGA inside (LookUp Table, LUT) and register REG form, interrelated between them; Have two groups of bus ports, be respectively input bus port and output bus port.Every group of bus port comprises clock, address, data, control signal and status signal, and the sequential relationship between them has strict difinition; The FIFO cache module is mainly realized the handoff functionality of clock zone, be that the clock zone of input/output bus is when inconsistent, by the input bus clock with metadata cache in the FIFO cache module, by the output bus clock data are read from the FIFO cache module again, finish first in first out (the First In First Out of data, FIFO), thus realize the handoff functionality of clock zone.
Described local bus control module is the controller module that of being realized by FPGA internal logic resource and CPU carry out interaction data.Control and status signal that it sends according to the FIFO cache module that is connected with it, transmit control signal and operate the input/output bus port of FIFO cache module, realize the read out function that writes of data, according to the interrogation signal of cpu bus, data are sent on the local bus or from the local bus up-sampling again.
The composition of described local bus interface module is identical with the composition of AT96 bus interface module, and also the inputoutput buffer IOB by FPGA inside forms.Local bus interface's module is mainly finished the signal level of FPGA inside and the mutual translation function of cpu bus signal level.
Described functional configuration module is made up of one group of register of FPGA inside.Functional configuration module major function is the parameter of configuration AT96 bus controller IP kernel, and mode of operation, interruption detection mode, principal and subordinate's switching and the indication running state information of AT96 bus controller IP kernel is set.
2, a kind of construction method of the AT96 bus controller IP kernel based on FPGA, these method concrete steps are as follows, and its process flow diagram is as shown in Figure 3.
Step 1: design input.According to AT96 bus protocol demand, design object is divided into each functional module.Functional module comprises AT96 bus interface module (001), AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004), local bus interface's module (005) and functional configuration module (006).Adopt hardware description language Verilog HDL to write code again and realize each function.For guaranteeing that sequential meets the demands, write the logical sequence unbound document simultaneously.
Step 2: functional simulation.Utilize the ModelSim emulation tool that each functional module and top-level module are carried out functional simulation, whether meet design requirement according to the function of analyzing each functional module and top-level module in the oscillogram of functional simulation.If do not meet the demands, return step 1, revise the function module design code that does not meet the demands.Till meeting the demands.
Step 3: logic synthesis.Utilize Xilinx ISE translation and compiling environment or Synplify translation and compiling environment to create project file, each functional module that will be by functional simulation and sequential unbound document are provided with the translation and compiling environment parameter and make compiling output comprise logic netlist EDIF file and input/output port supporting paper as input file.
Step 4: preceding emulation.It is distributing functional simulation before.In the ModSim emulation tool, the output net meter file EDIF file of step 3 is set up Simulation Engineering as input file, carry out the preceding functional simulation of distributing.Judge according to simulation result whether allomeric function meets design requirement.If do not meet the demands, return step 1, revise the function module design code that does not meet the demands.Till meeting the demands.
Step 5: output net meter file.Because the IP kernel calling module that generates will be called use by other top layer logic modules, so can not insert IOBUF in the IP kernel.Therefore in the synthesis tool attribute, remove the option of Insert IO Buffer.Recompilate comprehensively the net meter file of the no IOBUF of output.
Step 6: output IP kernel calling module.After the logic synthesis, can export the net meter file of an EDIF form and the input/output port statement file of a correspondence.When calling this IP kernel, to call general input file the same for direct image in the logic top layer, and this input/output port file of exampleization joins the EDIF file in the logic project file simultaneously and gets final product.
Wherein, be a kind of hardware description language (Hardware Description Language) at the Verilog HDL language described in the step 1, be used to make digital circuit and be used for describing the design function of ASICs and FPGA.Verilog HDL fit algorithm level, register stage, logic level, design and descriptions at all levels such as gate leve and domain level.
Wherein, be the HDL Language Simulation software that Mentor company releases at the ModelSim emulation tool described in the step 2, it can provide friendly simulated environment, is the emulator that industry rs only single kernel is supported VHDL and Verilog hybrid simulation.
Wherein, at the Xilinx ISE translation and compiling environment described in the step 3 is the complete FPGA Integrated Development Environment that Xilinx company releases, function comprises design input, comprehensive, emulation, realization and download, the overall process that has contained the FPGA exploitation, on function, its workflow need not by any third party's eda software.The Synplify translation and compiling environment is the special logic synthesis tool at FPGA and CPLD realization that Synopsys company provides, this instrument has been contained the comprehensive of programmable logic device (PLD) (FPGAs, PLDs and CPLDs), checking, debugging, fields such as physical synthesis and prototype verification.EDIF is the head word abbreviation of electronic design interchange format (Electronic Design Interchange Format).The EDIF file is the standard format of exchange design data between the different EDA producer, has solved the data interchange problem of finishing design with different EDA producer instrument.
3) beneficial effect:
Adopt design proposal of the present utility model can realize effectively that with the AT96 bus be interconnected between a plurality of function devices of interface, it is that AT96 bus controller IP kernel is realized on the basis with FPGA that the utility model adopts the Verilog hardware language, its hardware design is flexible, configuration operation simple, portability is strong, the AT96 bus protocol is finished by FPGA hardware fully, reduced the load of CPU, compare asic chip, realize that with FPGA the AT96 bus controller greatly reduces application cost.
Description of drawings
Fig. 1 is a simple AT96 bus application example synoptic diagram;
Fig. 2 is the structured flowchart of the AT96 bus controller IP kernel based on FPGA of the present utility model;
Fig. 3 is the construction method FB(flow block) of the AT96 bus controller IP kernel based on FPGA of the present utility model
Symbol description among the figure is as follows:
RAM (Random Access Memory): random access memory;
CPU (Central Processing Unit): central processing unit;
FPGA (Field Programmable Gate Array): field programmable gate array;
A/D (Analog-to-Digital Converter): AD conversion unit;
D/A (Digital-to-Analog Converter): D/A conversion unit;
SG-1~N: simulating signal input 1 is to the N road;
CPLD (Complex Programmable Logic Device): CPLD;
IO: digital quantity input and output;
FIFO (First In First Out Memory): push-up storage;
DMA (Direct Memory Access): direct memory visit.
Embodiment
For design philosophy of the present utility model is described, provided a simple application example of AT96 bus at this, as shown in Figure 1.This application example system is by computing machine plate, AD plate, and IO plate and backboard are formed.The computing machine plate is initiated the operation of AT96 bus controller under the control of CPU module, remove control and visit AD plate and IO plate by the AT96 bus of backboard.Wherein the AT96 bus controller is the core of total system, for AT96 bus apparatus and subscriber equipment provide operation-interface, coordinate to carry out information interaction between AT96 bus apparatus and the subscriber equipment, make subscriber equipment can carry out the transmission of data according to the standard of AT96 bus.The design more complicated of AT96 bus controller, according to the heterogeneity of subscriber equipment, the AT96 bus apparatus is divided into main equipment and target device, and therefore, the AT96 controller also just has the branch of main equipment controller and target device controller.The AT96 bus master can initiatively be initiated the data transmission on the bus, and target device does not have this ability, and it can only be finished the data transmission of main equipment requirement by main equipment movingly.
In order to make other bus controller on the AT96 bus also can carry out master control to the AT96 bus, AT96 bus controller IP kernel in the utility model is designed to configurable, be that AT96 bus controller IP kernel can be configured to two kinds of patterns, a kind of is AT96 bus master controller, and it can initiate the control to the AT96 bus; Another kind is an AT96 bus target device controller, and it can not directly control the AT96 bus, but can be used as target device, makes other AT96 bus controller also can visit this node.Send instructions by under the host computer, by the CPU on this plate be controlled at two kinds under the mode of operation switching or be responsible for switching under two kinds of patterns by other main control equipment that has bus arbitration mechanism.
Embodiment:
Figure 2 shows that the functional module structure block diagram of realizing AT96 bus controller IP kernel based on FPGA.To carry out a bus read and write access by the AT96 bus controller is example, describes an embodiment of the present utility model.
1, a kind of AT96 bus controller IP kernel of the utility model based on FPGA, as shown in Figure 2, it is made up of AT96 bus interface module (001), AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004), local bus interface's module (005) and functional configuration module (006), as shown in Figure 2, position annexation between them and signal flow are to as described below.A) AT96 bus interface module (001) one end is connected on the AT96 bus interface card, the other end is connected to AT96 bus controller state machine module (002), its receive from data on the AT96 bus and control signal or send data and control signal on the AT96 bus; B) AT96 bus controller state machine module (002) is the control core of entire I P nuclear, and it adopts finite state machine FSM to realize the AT96 bus timing of AT96 bus protocol regulation and the reception or the control of transmission buffer memory of data.AT96 bus controller state machine module (002) is connected on the FIFO cache module (003), is controlled data and the control signal data that buffer memory receives in FIFO cache module (003) or read the data and the control signal data that will send from FIFO cache module (003) by AT96 bus controller state machine module (002); C) FIFO cache module (003) is used for the handoff functionality in AT96 bus clock territory and local bus clock territory, it is directly connected to local bus control module (004), is read the data and the control signal of reception or deposits the data and the control signal that will send on the AT96 bus in from FIFO cache module (003) by local bus control module (004) control; D) local bus control module (004) is connected to local bus interface's module (005), and local bus interface's module (005) is to realize the translation function of FPGA internal bus interface and cpu i/f; E) functional configuration module (006) all has with AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004) and local bus interface's module (005) and is connected, major function is the parameter of configuration AT96 bus controller IP kernel, and mode of operation, interruption detection mode, principal and subordinate's switching and the indication running state information of AT96 bus controller IP kernel is set.
Described AT96 bus controller state machine module (002) is the core of AT96 bus controller, finish the specific implementation of AT96 bus protocol internal control signal, comprise two submodules: one is the various control signals that realize the AT96 bus protocol by AT96 bus controller state machine; Another is an interface of realizing bus controller state machine and FIFO buffer memory unit, is used to realize receiving or sending the buffer memory of data.AT96 bus controller state machine according to control signal that is input to state machine and outside status signal, is realized the redirect between each status function under the beat of clock, under different conditions, and the control signal and the indicator signal of state machine output corresponding function.Other functional modules are finished Data Receiving, transmission and caching function according to the control signal and the indicator signal of state machine output.
The layoutprocedure of described AT96 bus controller IP kernel is as described below: terminal device disposes the parameter of IP kernel by local bus interface's module (005) or this node local bus (as CPU) by the register in the read-write capability configuration module (006), is used to determine the AT96 bus controller to work in memory module that the main equipment controller module still is slave unit controller module, FIFO buffer memory and mode of operation of local bus etc.
Describedly carry out the bus read and write access by the AT96 bus controller and can be described below respectively by data flow direction:
A) obtain the process of data from the AT96 bus: the operation of other AT96 bus controllers control this moment AT96 bus, with data, state and control information send on the AT96 bus, data on AT96 bus interface module (001) the sampling AT96 bus, state and control information, give AT96 bus controller state machine module (002) after being converted to the information format of FPGA inside, how the running status that state that AT96 bus controller state machine module (002) is sent here according to AT96 bus interface module (001) and control information decide bus state machine and the output of bus control information thereby whether decision receives from the data and the data of AT96 bus interface module (001) are handled.AT96 bus controller state machine module (002) deposits data in the FIFO cache module (003) in according to the data rate of AT96 bus, local bus control's module (004) reads data in the FIFO cache module (003) with the local bus data rate, so just realized the switching of different clock-domains, i.e. the conversion of data rate.Local bus interface's module (005) is sent to terminal device according to the local bus sequential format with data then, finishes the data transmission procedure from the AT96 bus to terminal device.
B) send the process of data on the AT96 bus: the mutual AT96 bus controller of this moment and terminal device is a master control equipment, the data that terminal device will send send to local bus interface's module (005) according to the local bus form, local bus interface's module (005) is finished the conversion of local bus data layout, and with data, state and control information send to local bus control module (004), after local bus control module (004) is converted to inner storage format with the local bus data, deposit FIFO cache module (003) in, the status information of FIFO cache module (003) offers AT96 bus controller state machine module (002) simultaneously, with the present store status of indication FIFO cache module (003), the status information that AT96 bus controller state machine module (002) provides according to FIFO cache module (003), in time from FIFO cache module (003), read the data message that will send, and decide the operation of AT96 bus controller state machine according to control and status information, AT96 bus interface module (001) correctly reads the data that will send to AT96 bus interface module (001) according to the running status of AT96 bus controller state machine, AT96 bus interface module (001) according to the form of AT96 bus protocol with data, state and control information send to the AT96 bus gets on, and finishes the process that sends data on the AT96 bus.
2, a kind of construction method of the AT96 bus controller IP kernel based on FPGA, these method concrete steps are as follows, and its process flow diagram is as shown in Figure 3.
Step 1: design input.According to AT96 bus protocol demand, design object is divided into each functional module.Functional module comprises AT96 bus interface module (001), AT96 bus controller state machine module (002), FIFO cache module (003), local bus control module (004), local bus interface's module (005) and functional configuration module (006).Adopt hardware description language Verilog HDL to write code again and realize each function.For guaranteeing that sequential meets the demands, write the logical sequence unbound document simultaneously.
Step 2: functional simulation.Utilize the ModelSim emulation tool that each functional module and top-level module are carried out functional simulation, whether meet design requirement according to the function of analyzing each functional module and top-level module in the oscillogram of functional simulation.If do not meet the demands, return step 1, revise the function module design code that does not meet the demands.Till meeting the demands.
Step 3: logic synthesis.Utilize Xilinx ISE translation and compiling environment or Synplify translation and compiling environment to create project file, each functional module that will be by functional simulation and sequential unbound document are provided with the translation and compiling environment parameter and make compiling output comprise logic netlist EDIF file and input/output port supporting paper as input file.
Step 4: preceding emulation.It is distributing functional simulation before.In the ModSim emulation tool, the output net meter file EDIF file of step 3 is set up Simulation Engineering as input file, carry out the preceding functional simulation of distributing.Judge according to simulation result whether allomeric function meets design requirement.If do not meet the demands, return step 1, revise the function module design code that does not meet the demands.Till meeting the demands.
Step 5: output net meter file.Because the IP kernel calling module that generates will be called use by other top layer logic modules, so can not insert IOBUF in the IP kernel.Therefore in the synthesis tool attribute, remove the option of Insert IO Buffer.Recompilate comprehensively the net meter file of the no IOBUF of output.
Step 6: output IP kernel calling module.After the logic synthesis, can export the net meter file of an EDIF form and the input/output port statement file of a correspondence.When calling this IP kernel, to call general input file the same for direct image in the logic top layer, and this input/output port file of exampleization joins the EDIF file in the logic project file simultaneously and gets final product.
Wherein, be a kind of hardware description language (Hardware Description Language) at the Verilog HDL language described in the step 1, be used to make digital circuit and be used for describing the design function of ASICs and FPGA.Verilog HDL fit algorithm level, register stage, logic level, design and descriptions at all levels such as gate leve and domain level.
Wherein, be the HDL Language Simulation software that Mentor company releases at the ModelSim emulation tool described in the step 2, it can provide friendly simulated environment, is the emulator that industry rs only single kernel is supported VHDL and Verilog hybrid simulation.
Wherein, at the Xilinx ISE translation and compiling environment described in the step 3 is the complete FPGA Integrated Development Environment that Xilinx company releases, function comprises design input, comprehensive, emulation, realization and download, the overall process that has contained the FPGA exploitation, on function, its workflow need not by any third party's eda software.The Synplify translation and compiling environment is the special logic synthesis tool at FPGA and CPLD realization that Synopsys company provides, this instrument has been contained the comprehensive of programmable logic device (PLD) (FPGAs, PLDs and CPLDs), checking, debugging, fields such as physical synthesis and prototype verification.EDIF is the head word abbreviation of electronic design interchange format (Electronic Design Interchange Format).The EDIF file is the standard format of exchange design data between the different EDA producer, has solved the data interchange problem of finishing design with different EDA producer instrument.