Adding DMA Controller
- Purpose of this tutorial is to understand the impact of a Direct Memory Access on the model built in Scenario 4.
VisualSim Model
Refer Fig 1 for the intended VisualSim Model.
Figure 1: VisualSim Model
VisualSim Model for the tutorial can be found in following location
$VS\doc\Training_Material\Tutorial\WebHelp\Tutorial\Architecture_Exploration\Processor_Modeling_Tutorial\Processor_Modeling_Part1_DMA.xml
Building the VisualSim Model
Blocks Used
In addition to the blocks used in Scenario 4, this model uses the blocks listed in the following table.
S.No.
|
Library Block
|
Description
|
1
|
Device Interface
|
This block adds
the device name to the Routing Table and maps the incoming data
structures fields to the equivalent in the Processor_DS.
Click here for detailed description and examples.
|
2
|
DMA
|
This
block represents a memory controller that sits between the Processor or
bus or I_O Block and the Memory bank. The IO Controller acts as an
intermediate block and just transfers the transactions from bus or DMA
Controller to appropriate memory bank or devices connected to the IO
Controller.
Click here for further details.
|
3
|
DMA Database
|
This
block is a lookup table or database containing rows and columns. Each
row is a data structure. Each column of the row is a field of the data
structure.
Click here for further details.
|
Initial Setup
- Define the following additional parameter from Model Setup.
Sets the value for the size of the tasks (Store and Load).
Architectural Elements
Add the following architectural elements to the ones existing in scenario 4.
- Drag and drop a Traffic block from Traffic to represent a device that generate transaction.
- In the Traffic block,
- Enter the Data_Structure_Name as "Processor_DS".
- Enter Value_1 as 1.0e-3.
- Select Time_Distribution as Fixed (Value_1).
Figure 1: Traffic Parameters
- Add an ExpressionList block from Behavior to categorize the instruction as Store or Load.
- Define the following fields in the Expression_List parameter.
Generate random numbers to assist in the selection of tasks.
- input.A_Source = "Display_Intf"
Adds a field to the datastructure to store the name of the device that sends the transactions.
- input.A_Instruction = (RandNum >= 50)?{"Store"}:{"Load"}
Use random numbers to select a task.
This flag is set to true when the memory sends an acknowledgment for a Store task. Then, the behavior flow is triggered.
- input.A_Task_Name = "Display_Task"
Adds a field to the datastructure to store the name of the task.
- input.A_Bytes = DMA_Bytes
Adds a field to store the value for the size of a task. This value is set as part of the initial parameters.
The rest of the parameters retain the default settings.
Figure 2: ExpressionList Parameters
- Add a DeviceInterface block from HardwareSetup.
- In the DeviceInterface block enter,
- IO_Name as "Display_Intf"
- IO_Bytes as "A_Bytes"
The rest of the parameters retain the default settings.
Figure 3: Device Interface Parameters
- Drag and drop a DMADatabase block to store the details of the tasks.
- In the DMADatabase block,enter Linking_Name as "DMA_DB".
- Enter the following details in the Data_Structure_Text parameter.
A_Task_Name
A_Instruction A_IDX
A_Task_Source Burst_Word_Size
A_Task_Address A_Command
A_Bytes A_Priority
A_Destination ;
Display_Task Load
0 DRAM
32
1
Read
DMA_Bytes
0
DMA ;
Display_Task Store
0 DRAM
32
1
Write DMA_Bytes
1
DMA ;
|
Figure 4: DMA Database Parameters
- Add a DMA block from HardwareDevices.
The DMA block references DMADatabase for details of the tasks.
- In the DMA block, modify the following parameters.
- DMA_Controller_Name: "DMA"
- Memory_Database_Reference: "DMA_DB"
- DMA_to_Device_Cycles: 1
- DMA_to_Device_Address: 1
- Device_to_DMA_Cycles: 1
- Channel_FIFO_Buffers: 20
- Speed_Mhz: Processor_Clock
- DMA_Channels: 2
Figure 5: DMA Parameters
- Add a BusInterface block from HardwareDevices.
- Change Port_Name_1 to "Port_Name_5".
- Change Port_Name_2 to "Port_Name_6".
The rest of the parameters retain the default settings.
Figure 6: BusInterface Parameters
Behavior Flow
Modify the following blocks from Scenario 4.
- Replace the Traffic block with a TriggeredTraffic block from Traffic.
- Modify the Data_Structure_Name to "Processor_DS".
Figure 7: TriggeredTraffic Parameters
- In the SelectProcessor block, use the Expression_List to add the following field to the datastrucutre.
This field ensures that the selected processor processes the subsequent tasks.
Figure 8: Select Processor Parameters