Saturday, January 16, 2010

SOC Boot Concept


Complex SOCs have one or more processors to perform some protocol level functionality. The processors could be an MCU or DSP or any other microcontroller fetching, decoding and evaluating SW instructions from a memory.
I'm providing some steps of a system which has multiple processors, an external boot rom, an SDRAM, processor TCM, and Level 2 cache controller.
In this picture, it is the job of the Master MCU to wake up first, when the system reset is asserted. This means, the boot loader picks up the OS for the system MCU first.
Boot Loader:
The small program that starts this sequence of loading into RAM, is known as a bootstrap loader, bootstrap or boot loader. This small boot loader loads data and programs which are then executed from internal/external RAM.
Second-stage boot loader:
The small program is most often not itself an operating system, but only a second-stage boot loader. It will then be able to load the operating system properly, and transfer execution to it. The system will initialize itself, and may load device drivers etc. for the OS.

All this time, the two DSPs which are under the control of the MCU are still under reset. Once the Master MCU boots, and is ready, sometime later the reset for the DSPs is de-asserted, possibly by a direct/indirect control of the MCU.

Following is the set of steps carried out typically by a DSP/generic MCU once the reset is released/de-asserted:
1. Initially he HALT signal for the processor/DSP ensures it doesn't fetch any instructions until the processor is ready
2. The HALT is de-asserted possibly by a write from the Master MCU into a control register as shown above
3. This means the processor/DSP is free to fetch instructions & data
4. The reset vector is generally 0x0, depends you need to check the SW user manual for the processor
5. This could possibly be either an access to a TCM or SRAM
6. Code should have been already placed in to the TCM or SRAM by the MCU.
7. Once the boot code is executed, there might be a jump to the external SDRAM to fetch and execute more instructions.

The boot code itself requires some system level initialization or setup and mostly consists of the following:
1. Enable both instruction and data TCMs
2. Copy any exception vectors [for aborts, Software interrupts, IRQ, FIQ etc.]
3. Configure the settings for the MMU/MPU
4. Invalidate the cache
5. Enable the Cache and MMU/MPU
6. Initalize the cache controller for L2
7. Jump to the main program in SDRAM

Tuesday, January 5, 2010

"C" constructs for verification



This module details the usage of writing verification test software in C
1. Representation of hardware registers in C
2. Symbol file providing module base address
3. Accessing the module register in a test-case

Question 1 : How do you represent hardware registers in "C"?

In C modules are represented using structures, since it is simply an amalgamation of logically unified registers. The registers themselves are of either byte, word or double word, or double double word.
The representation is as follows :
unsigned char byte : BYTE : 8 bit
unsigned short int : WORD : 16 bit
unsigned long int : DOUBLE_WORD : 32 bit
unsigned long long : DOUBLE_DOUBLE_WORD : 64 bit
It all depends on the size of the register you are accessing. I haven’t seen any granularity other than this, that’s how processors work; they work on bytes or multiples thereof.
Now typically during your verification you would come across data which are represented as uint16 or uint32, they are no different from their definitions above:
typedef unsigned char uint8
typedef unsigned short int uint16
typedef unsigned long int uint32
typedef unsigned long long uint64

If you want them signed simply substitude unsigned with signed above,
typedef signed char int8
….

As an example lets say you have a module called GPD [General purpose device] and it has a SW register map as follows


You could create a structure as follows:

typedef struct{
volatile uint32 REV_NO; /*REV NO*/
volatile uint32 CLOCK_CONTROL; /*Clock control */
volatile uint16 INT_STATUS; /* Interrupt Status */
volatile uint16 INT_MASK; /* Interrupt Mask */
volatile uint32 CONFIG_SETTING; /* Configuration Setting */
} ASIC_GPD_STR

What does the volatile data type do for you ?
Simply put volatile tells the compiler to not make any assumptions about the value of the variable defined. It can change anytime, and it probably will, because not all registers are in total control of the processor, and especially HW status registers. This tells the compiler to go load the value from the register directly each and every time it needs it instead of treating it like a value in the processor register. Also it might require the MPU settings of your processor to make sure that such registers are not cached for any reason, and they will not be pushed on to stack like other variables.

You can put this structure into the sw_module_name/module_name_hardware.h header file
We are only done with defining our module. We need to breathe some life in to it, in order to allow for the processor to access it.

For this we need to do two things:
1. Tell the processor what the actual structure maps to
2. Make an allocation of memory of this structure

Question 2 : How do you map the base address of a module to the pointer to the structure just defined?

The actual structure’s base address is what you need to indicate to the compiler. This is usually done in a symbol file : The actually base address of all modules is defined out here, for both design and test-bench data structures:

0xA000_0000 asicGPD // This tells the compiler, and the processor where to access the module in the test-case
0xB000_0000 asicInterrupt_Controller
0xC000_0000 asicTB_Slave_1

Question 3 : And finally, how does the processor actually access the hardware register?
In actual Verification Test Software you can access the registers as follows:

#include "asicGPD_hardware_structure.h"
.....
integer module_access_test()
{
volatile ASIC_GPD_STR *asicGPD; /* This creates a pointer to the structure*/
uint16 mask_value;
uint32 config_setting;
integer errors = 0;
config_setting = 0x11112222;

mask_value = busread_register(asicGPD->Interrupt_Mask);
if(mask_value != interrupt_mask_register_default) {errors = errors++;}
buswrite_register(asicGPD->Config_Setting, config_setting);
return errors;
}

Friday, January 1, 2010

The ASIC design flow


ASIC's are extremely complicated and unwielding beasts. If you get to work on one from scratch and work on a multi million gate ASIC from spec till product, the life cycle can be any where upwards of two years until you see your product in the market. Quite often the pressure to market introduces issues in design and timing, the only two aspects of the ASIC which would stop it from doing what it is supposed to do. However a good synergy of front-end and back-end teams can successfully deploy a full custom chip without issues, provided they manage to plan, prepare, and anticipate.

We detail here the typical ASIC flow for first timers and folks new to the industry as to what it takes to get and ASIC back in silicon.

1. The Architecture team specifies the workability of design - how many MIPS would your processor require, what is the throughput of your interconnect, what is the peak data rate processing capability of your HW/SW combine, what is the SDRAM controller bottleneck - it quantifies roughly how well your design ought to work.

2. RTL coding in HDL - American companies usually prefer Verilog, while their cross-Atlantic counterparts prefer VHDL. VHDL is the more strongly typed, better suited language for synthesis, whereas Verilog is the more easier to understand, C kind of HDL.

3. If your design contains memories : RAMs TCMs specifically on chip on design memories - you would need to do DFT memory BIST insertion to be able to check the memories after production. If your RTL design is dependant on certain technology libraries, for example if you use the IBM/Artisan design flow, or a vendor specific technology, you would require the basic technology library cells to map on to your design.

4. The RTL design is meanwhile subjected to strenuous verification from the verification team to check design intent versus design content. This means using multiple approaches

a. Creation of TB using HDL

b. If your design contains one or multiple processors : Hardware Software Cosimulation based environment using C to write your tests, and having a compiler convert them in to Assembly [x86, ARM]

c. Usage of HVL such a Specman e, Vera or System Verilog [OVM, or VMM methodologies] for doing exhaustive contrained & random verification, collecting code coverage metrics etc.

d. Usage of static formal techniques such as Cadence IFV

e. Creation of dynamic assertions in PSL or SVA

f. Emulation using prelimary version of software - this involves mapping of RTL into FPGA's and having SW test the HW that it will eventually target when the ASIC is made. This helps speed up simulations by factors of over 100x, and it helps SW teams to ramp up and get ready, even before the final ASIC is available on PCB.

5. In Synopsys DC or Magma, you would write constraints for clock, area, power, etc. Once you have the constraints you'd synthesize your design and add scan insertion (JTAG for processor -- SW tracing) .

6. Formal verification - that is comparison of RTL against the synthesized netlist, using Cadence LEC, Synopsys Formality etc.

7. Pre-layout STA on the design using Synopsys PT engine.

8. Initial floorplanning with timing driven placement of cells, clock tree insertion and global routing, hard macros, clock tree synthesis

9. Transfer of synthesized clock tree to the netlist [made from synthesizing RTL] back into Design Compiler.

10. Formal verification between the synthesized netlist and clock tree inserted netlist.

11. Extraction of timing delays from the layout after the global routing step - sdf.

12. Back annotation of estimated timing data from the global routed design, in to PrimeTime.

13. Extraction of real timing delays and back annotation of the real extracted timing data to PrimeTime.

14. Post-layout static timing analysis using PrimeTime.

15. PV : Physical Verification : Tape out after LVS and DRC verification using IC Compiler