VHDL CODE GENERATION

 

DECISIONS TAKEN IN GENERATING THE VHDL CODE

The GCI Automation tool generates VHDL code for the data read in through the word document. Hence knowledge of VHDL is a pre-requisite in the formation of the tool. This forces the designer to consider what decisions are to be taken in the formation of the VHDL code right from the leaf level to the uppermost node. This step is meticulously followed since it facilitates efficient coding and further enhancements. This step enlists detailed information of the signals to be included in the entity, syntax and semantics of the language, generics involved, structure of the top-level multiplexers and also about the style of modeling to be used in particular design criteria. It also gives the coder an idea as to what statements are repetitive, where to assign specific access types and also as to what signals to concatenate in the generation of an output signal. The genesis of this VHDL entity is from the base level flip-flops being the utmost base level entities.

 

Decisions for the basic register entity:

Signals that are to be serviced at this level are as follows:

  1. reg_data_in: We need to determine the width of this signal. The width of this signal is available from the bit-width (BSW) summation, which is available from the second structure. Pointer to this particular data is bnkptr->no_of_bits.
  2. reg_reset_input & gci_clk: These two signals are necessary signals since they determine the reset signals and the gci clock signals respectively that are inputted from the interface between the microprocessor, the gci and the core.
  3. write_request: this is one more input signal, which is essential to be specified. This request can be made by the core to the GCI or by the microprocessor to the GCI. Accordingly the code has to be written for the write request signal.
  4. reg_data_out: reg_data_out obviously is an output signal, which is the outlet to the entity at base level. Its width depends upon the BSW and the reset signal.
  5. regsel: Enable signal for the flip-flop which is used at base level. regsel signal is clubbed with the enable signals in each component instantiations.

 

Check –1:

If the reg_reset_input signal is high then the reg_data_out signal will naturally be the concatenation of all the default values, present in the table. Secondly we have to check whether individual resets in each base level flip flop is high. If this regsel signal is high then data_out of that flip flop is the default value. All other flip-flop’s data_out is the value stored in it.

 

Check-2:

It may so happen that a particular number of flip flop may be of UNUSED status. If this is the case then the data_out of that flip-flop will contain the default value already specified in the table for that register. Check-2 also becomes very important in the context that we don’t have to instantiate components for the unused bits, as it would lead to unnecessary wastage of memory space and resources. Hence it becomes very necessary to know the unused or rather the used bits only. The starting bits and ending bits SBN and EBN respectively will be given by the structure so the bus width of each row in the table will be known. By scrutinizing the ACCESS type given by the structure we can conclude whether the bits are unused or not. If the ACCESS type doesn’t match to pre-defined formats then (EBN –SBN) number of bits will have default values at their respective data_out signals.

Components for (total _no_of_bits – unsued_bits – resetted_bits) will have to be instantiated and the concatenation of the data_out for these bits is done to form the reg_data_out signal. To provide functionality to each bit in the table we are instantiating a component for each bit. This component is nothing but a simple flip-flop.

MULTIPLEXER DESIGN FOR THE SAME REGISTER TYPE

This multiplexer is the next level of hierarchy after the basic register entity. The register multiplexers and the registers are then declared as components in the structural modeling for the bank entity

Here is an algorithm to generate VHDL code for this multiplexer:

  • The register enable input is declared in this entity. This signal will be given to the address decoder. This requires just writing to file instructions
  • The packet counter signals are again input signals, the output is in the format

Registername_data_tx.

  • The above signals have to be read from the word file and hence it requires file handling operations
  • We have to multiplex the appropriate signals to the register data output depending upon the register enable input. For this purpose we first of all have to count the no of register banks given by TOP.size()
  • String comparison has to be done in Java so that we generate the appropriate enable code. Method followed is one hot method of decoding
  • The file reading has to be done carefully to note down the exact signals that are interfaced in the different banks.

REGISTER BANK ENTITY

  • This is the next level after we create a mux for each bank in the TOP linked list.
  • For particular bank entity type we have to declare the individual registers in the bank, the bank multiplexers etc as components in the register bank entity.

Eg:

Here tx_intr is the interrupt bank, which contains individual registers and the multiplexer:

entity txintr is

port(

rxclk : in std_logic;

……….. ………..

-- Rx Handshake Interface

read_req_rx : in std_logic;

………….

);

end txintr;

architecture structure of txintr is

component txintmux(

the interfaces of this entity);

component txintreg(

interfaces of this entity);

thus the bank will be created .The output of this bank structure will be muxed to the Tx-Multiplexer depending upon register enables of the address decoder.

top.gif (658 bytes)

ALGORITHM FOR THE Tx-MUX ENTITY: 

  • Create a new file in which the Tx Multiplexer (VHDL) code will be stored. We have stored it as "topmux.vhd"
  • Declare signals such as reset and txclk, which interact with the entity top multiplexer. Here no decisions are to be taken.

Pin description for the Tx-Multiplexer:

PIN NAME

DIRECTION

DESCRIPTION

Txclk

IN

Clock Signal for the GCI

Reset_bar_txclk

IN

Reset signal

Pmon_regsel_tx

IN

Interface with the address decoder

Intr_regsel_tx

IN

Interface with the address decoder

Hold_regsel_tx

IN

Interface with the address decoder

Hold_data_tx

IN

Interface with the hold register bank

Intr_data_tx

IN

Interface with the Interrupt register bank

Pmon_data_tx

IN

Interface with the PMON register bank

Txposreg_data_rx

OUT

Sixteen bit data out signal in the interface with the handshake block

Txposreg_data_ready

OUT

Ready signal

 

  1. For this purpose: Check the size of the linked list TOP that gives the number of banks read from word document
  2. Declare all the bank register select signals as input signals in the top mux entity
  • Interface with the handshake block comes next:

 

  1. Declare the 16 bit data signal txposreg_data_tx as an output signal in this multiplexer module
  2. Synchronization signal txpos_data_ready is declared as the other output signal

 

The multiplexing process begins by first selecting the bank on the basis of the select_bus signal. This method is one hot in the sense that whenever a particular register is selected that particular bit in the select_bus signal is high.

Code snippet to conceptualize this step:

when "000001" =>

txposreg_data_tx <= statusreg_data_rx;

when "000010" =>

txposreg_data_tx <= configreg_data_rx;

when "000100" =>

txposreg_data_tx <= holdreg_data_rx;

when "001000" =>

txposreg_data_tx <= pmonreg_data_rx;

 

Once the bank is selected the output of the bank is put through as output of the multiplexer. In case the value of the select_bus signal is anything other than the specified values the value of the multiplexer o/p is set to be ground_data.

 

when others =>

txposreg_data_tx < = ground_data_tx;

top.gif (658 bytes)

Decisions for the address decoder block:

The address decoder block is an integral part of any complex design as it plays an important function of decoding the address generated by the user and accessing the specified register. In the given GCI we have five banks of registers (refer to the architecture of the GCI). Hence the number of banks is fixed but the number of registers in each bank is not fixed. The user has to specify the bank type. In this case we use three bits for assigning each bank a separate and unique identity.

Algorithm for Address Decoder

Algorithm for Address Decoder;

  1. Write the Port information/declaration of an address decoder with Signals like Reset, Clock etc. Following are the signals coming to/outgoing from Address Decoder.
  • Address_sync: Its width will be determined by taking the logarithm of maximum value of address, to the base two. The address of register to be selected will be on this bus.
  • Reset, csb_sync, txclk are three single bit signals coming to Address decoder.
  • Regsel: As one hot method is used for selection of register, this bus will have the width equal to the number of registers in GCI. This is outgoing signal from Address Decoder.
  1. Calculate number of registers in that Bank, which is the width of Register Select Bus,
  2. If Reset or csb_sync is high, deselect all Registers,
  3. When a particular address is on Address Bus, make that Register Select line high,
  4. For any invalid address, deselect all Registers,
  5. Repeat the steps 4-5 for all Registers.

 

CODE TESTING AND RTL SYNTHESIS:

Generic Controller Interface

The following instructions are for simulating the Generic Controller Interface on the Modeltech V-System simulator version 4.4j. Other simulators or other versions of the V-System simulator may involve steps not listed below.

Assumption :

We assume that the product database has been unzipped into C:\mydir\GCI. If you have installed the product database into some other directory, replace its path in the place of "c:\mydir" in the instructions that follow.

Note : V-System accepts file paths delimited by "/" or "\".

Setup :

1. Select the Working Directory as C:\mydir\GCI\sim. This is essential as the Report file generated by the Test bench gets stored in the same working directory.

2. Confirm, or change to, these simulator settings:

i) simulator resolution to ps.

ii) "ignore warning" turned on.

iii) set TabWidth = 4

Functional Simulation :

The functional simulation can be carried out using following steps

In compile options set "use explicit declarations only"

RTL Compilation

1. Create a library called work in the working directory.This is done by executing the following command at the V-System command prompt.

vlib work

2. Define a V-System environment variable projdir by using the following command

set projdir C:/mydir/GCI

3. Execute a macro from C:\mydir\GCI\macro, which will compile both the CoreCell and the Test Bench. This is done by executing following command at the V-System command prompt.

do $projdir/macro/makeall.do

RTL Simulation

1. Copy the test scripts as txtest.cmd and rxtest.cmd to the current working directory. Make sure that the same functional scripts are run for rx and tx , at the same time, e.g. rxsonet.cmd and txsonet.cmd should be copied as rxtest.cmd and txtest.cmd

vsim itop

run 12100 us

2. Similarly copy rxsdh.cmd and txsdh.cmd as rxtest.cmd and txtest.cmd

run 14 ms

3. Run other scripts in a similar manner with the time specified in the script files

4. Check the report file for errors. The simulator generates three test reports called 'mup.rep', 'rxerr.rep', 'txerr.rep' in the current directory. This file may be examined for errors. Presence of 'Test failure' in the report indicates failure at some point during the test. 'mup.rep' contains information about microprocessor transactions.

home.gif (668 bytes)