[an error occurred while processing this directive]
Вот как я делал...
(«Телесистемы»: «Конференция «Программируемые логические схемы и их применение»»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Pashka 14 апреля 2003 г. 18:00
В ответ на: Очевидно, я невнятно объяснил, или чего-то недопонял ... отправлено Пытливый 14 апреля 2003 г. 14:37

Есть простая модель проца (BFM). Там есть процедуры чтения/записи.

task Read; //(Select, addr, Expected data, actual data);
input [1:0] Select;
input [17:0] addr;
input [23:0] ExpReadData;
output [23:0] ActualData;
// reg [23:0] ActualData;
time RDNAssert;


begin
A = addr; AA = ~(1 << Select);
#RDNASETUP wait (StrobeDisable == 0);
RDN = 0; RDNAssert = $realtime;
repeat (WaitStates + 1) @(posedge Clk);
#RDNWIDTH while (TANz) @(posedge Clk); // Use re-timed TAN
//if (DChange > (RDNAssert + DINDELAY))
// tb.Error("DSP56303: Read data setup violation");
// Zero ns hold
// The double XOR is to put X-states in the actual data
// in same place as the mask in the Expected data
ActualData = D;
$display("%0t: DSP56303 Read address = %h, actual data = %h",
$time, A, ActualData);
if ((D ^ ExpReadData ^ ExpReadData) !== ExpReadData)
begin
//tb.Error("DSP56303: Wrong data read");
$display("Expected %h %h %h, got %h %h %h",
ExpReadData[23:16], ExpReadData[15:8], ExpReadData[7:0],
D[23:16], D[15:8], D[7:0]);
end
RDN = 1;
#RDNAHOLD A = 'hx; AA = 'hF;
StrobeDisable = 1;
StrobeDisable <= #RDNRECOVER 0;
end
endtask

task Write; //(Select, addr, data);
input [1:0] Select;
input [17:0] addr;
input [23:0] WriteData;

begin
A = addr; AA = ~(1 << Select);
#WRNASETUP wait (StrobeDisable == 0);
WRN = 0;
fork
#DOUTDELAY DataOut = WriteData;
begin
#WRNWIDTH repeat (WaitStates + 1) @(posedge Clk);
while (TANz) @(posedge Clk); // Use re-timed TAN
WRN = 1;
end
join
$display("%0t: DSP56303 Write address = %h, data = %h",
$time, A, WriteData);
fork
#WRNDHOLD DataOut = 'hz;
#WRNAHOLD A = 'hx;
join
AA = 'hf;
StrobeDisable = 1;
StrobeDisable <= #WRNRECOVER 0;
end
endtask


На уровне модели всей платы модель проца мапится как DSP1 и DSP2. Составляются более сложные процедуры:
task DSP1WriteCell;
begin
$display("DSP1 is writing the ATM cell data");
#200 DSP1.Write(0, 'h00, {8'h00, CellByte00, CellByte01});
#200 DSP1.Write(0, 'h01, {CellByte02, CellByte03, CellByte04});
#200 DSP1.Write(0, 'h02, {CellByte05, CellByte06, CellByte07});
#200 DSP1.Write(0, 'h03, {CellByte08, CellByte09, CellByte10});
#200 DSP1.Write(0, 'h04, {CellByte11, CellByte12, CellByte13});
#200 DSP1.Write(0, 'h05, {CellByte14, CellByte15, CellByte16});
#200 DSP1.Write(0, 'h06, {CellByte17, CellByte18, CellByte19});
#200 DSP1.Write(0, 'h07, {CellByte20, CellByte21, CellByte22});
#200 DSP1.Write(0, 'h08, {CellByte23, CellByte24, CellByte25});
#200 DSP1.Write(0, 'h09, {CellByte26, CellByte27, CellByte28});
#200 DSP1.Write(0, 'h0a, {CellByte29, CellByte30, CellByte31});
#200 DSP1.Write(0, 'h0b, {CellByte32, CellByte33, CellByte34});
#200 DSP1.Write(0, 'h0c, {CellByte35, CellByte36, CellByte37});
#200 DSP1.Write(0, 'h0d, {CellByte38, CellByte39, CellByte40});
#200 DSP1.Write(0, 'h0e, {CellByte41, CellByte42, CellByte43});
#200 DSP1.Write(0, 'h0f, {CellByte44, CellByte45, CellByte46});
#200 DSP1.Write(0, 'h10, {CellByte47, CellByte48, CellByte49});
#200 DSP1.Write(0,'h40, 'h3b);
$display("DSP1 finished writing the ATM cell data");
end
endtask

task DSP2ReadCell;
begin
$display("DSP2 is reading the ATM cell data");

#200 DSP2.Read(0, 'h20, 'hXX, {CellByte00, CellByte01});
#200 DSP2.Read(0, 'h21, 'hXX, {CellByte02, CellByte03});
#200 DSP2.Read(0, 'h22, 'hXX, {CellByte04, CellByte05});
#200 DSP2.Read(0, 'h23, 'hXX, {CellByte06, CellByte07});
#200 DSP2.Read(0, 'h24, 'hXX, {CellByte08, CellByte09});
#200 DSP2.Read(0, 'h25, 'hXX, {CellByte10, CellByte11});
#200 DSP2.Read(0, 'h26, 'hXX, {CellByte12, CellByte13});
#200 DSP2.Read(0, 'h27, 'hXX, {CellByte14, CellByte15});
#200 DSP2.Read(0, 'h28, 'hXX, {CellByte16, CellByte17});
#200 DSP2.Read(0, 'h29, 'hXX, {CellByte18, CellByte19});
#200 DSP2.Read(0, 'h2a, 'hXX, {CellByte20, CellByte21});
#200 DSP2.Read(0, 'h2b, 'hXX, {CellByte22, CellByte23});
#200 DSP2.Read(0, 'h2c, 'hXX, {CellByte24, CellByte25});
#200 DSP2.Read(0, 'h2d, 'hXX, {CellByte26, CellByte27});
#200 DSP2.Read(0, 'h2e, 'hXX, {CellByte28, CellByte29});
#200 DSP2.Read(0, 'h2f, 'hXX, {CellByte30, CellByte31});
#200 DSP2.Read(0, 'h30, 'hXX, {CellByte32, CellByte33});
#200 DSP2.Read(0, 'h31, 'hXX, {CellByte34, CellByte35});
#200 DSP2.Read(0, 'h32, 'hXX, {CellByte36, CellByte37});
#200 DSP2.Read(0, 'h33, 'hXX, {CellByte38, CellByte39});
#200 DSP2.Read(0, 'h34, 'hXX, {CellByte40, CellByte41});
#200 DSP2.Read(0, 'h35, 'hXX, {CellByte42, CellByte43});
#200 DSP2.Read(0, 'h36, 'hXX, {CellByte44, CellByte45});
#200 DSP2.Read(0, 'h37, 'hXX, {CellByte46, CellByte47});
#200 DSP2.Read(0, 'h38, 'hXX, {CellByte48, CellByte49});
#200 DSP2.Write(0,'h40, 'hb3);
$display("DSP2 finished reading the ATM cell data");
end
endtask

А в тестбенче они вызываются.
Это конечно не простой пример, просто первым попался под руку.


Составить ответ ||| Конференция ||| Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов ||| Конференция ||| Архив ||| Главная страница ||| Содержание

E-mail: info@telesys.ru