[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [oc] Need some Help..
Hello,
Here is the way in which i fill an array for a compact flash model reading
an external binary file that is a "dump" of a certain part of a hard disk
(generate with norton utilities). I wish it will be helpful. The array type
is :
--
-- ARRAY INCLUDES LBA ADDRESSING FOR EACH SECTOR
type CHR_BUFFER is array (0 to range_lba_27_24,0 to range_lba_23_16,0 to
range_lba_15_8,0 to range_lba_7_0, 0 to (bytes_per_sector-1)) of
std_logic_vector(7 downto 0);
The filling code :
--
-- ARRAY FILL
--
FILL_ARRAY:process
--
-- FILE VARIABLES
--
--
-- content of the compact flash
--
type IntegerFileType is file of integer;
file dataout:IntegerFileType;
variable fstatus: FILE_OPEN_STATUS;
variable integer_readed : integer;
variable vector_readed : std_logic_vector (31 downto 0);
variable error_on_read : boolean;
begin
file_open(fstatus, dataout,"./F16_0_51.BIN");
L1 :
for LBA_27_24 in 0 to range_lba_27_24 loop
for LBA_23_16 in 0 to range_lba_23_16 loop
for LBA_15_8 in 0 to range_lba_15_8 loop
for LBA_7_0 in 0 to range_lba_7_0 loop
for integer_pos in 0 to ((bytes_per_sector/4)-1)loop
read(dataout, integer_readed);
vector_readed :=
CONV_STD_LOGIC_VECTOR(integer_readed,32);
cf_buffer
(LBA_27_24,LBA_23_16,LBA_15_8,LBA_7_0,integer_pos*4) <= vector_readed (7
downto 0) ;
cf_buffer
(LBA_27_24,LBA_23_16,LBA_15_8,LBA_7_0,(integer_pos*4)+1) <= vector_readed
(15 downto 8);
cf_buffer
(LBA_27_24,LBA_23_16,LBA_15_8,LBA_7_0,(integer_pos*4)+2) <= vector_readed
(23 downto 16);
cf_buffer
(LBA_27_24,LBA_23_16,LBA_15_8,LBA_7_0,(integer_pos*4)+3) <= vector_readed
(31 downto 24);
-- assert error_on_read report "File read error"
severity note;
end loop;
end loop;
end loop;
end loop;
end loop;
wait;
end process;
At 18:23 26/02/2003 +0000, you wrote:
>you can try this
>
>type load_file_type is file of real;
>file load_file : load_file_type open read_mode is load_file_name;
>variable addr: natural;
>
>begin
>--load memory contecnts from load_file
>addr := 0;
>while not endfile(load_file) loop
>read(load_file, index(addr));
>addr := addr + 1;
>end loop;
>..............
>
>Thanks,
>--Ram K.
>
>
>
>
>>From: "Dharmeshbhai PATEL" <dpatel@ifrance.com>
>>Reply-To: cores@opencores.org
>>To: <cores@opencores.org>
>>Subject: [oc] Need some Help..
>>Date: Wed, 26 Feb 2003 10:34:12 GMT
>>
>>Hi List,
>>
>>
>>I want to do the following things in vhdl.
>>
>>
>>I have in my Tesbench the following signal.
>>
>> Type Memory is array 0 to 16 od REAL;
>> signal index : Memory;
>>
>>
>>And I want to initialized this Memory array with an external file in
>>witch there are some Real parametres.
>>
>>Some body can tell me how to write the process to do this.
>>
>>I'm not very familiar with read files function in VHDL.
>>
>>
>>
>>Thanks a lot in advance.
>>
>>
>>_____________________________________________________________________
>>GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321
>>(prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné.
>>Règlement : http://www.ifrance.com/_reloc/sign.sms
>>
>>
>>--
>>To unsubscribe from cores mailing list please visit
>>http://www.opencores.org/mailinglists.shtml
>
>
>_________________________________________________________________
>STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>--
>To unsubscribe from cores mailing list please visit
>http://www.opencores.org/mailinglists.shtml
----------------------------------------------------------------------------------------------------------------------
Armando Astarloa Cuéllar - Universidad del Pais Vasco UPV/EHU
Tecnología Electrónica
Departamento de Electrónica y Telecomunicaciones
Escuela Superior de Ingenieros - Email: jtpascua@bi.ehu.es
Ald. de Urquijo s/n Tel.: 34 - 94 - 601 73 04
48013 BILBAO (SPAIN) Fax.: 34 - 94 - 601 42 59
----------------------------------------------------------------------------------------------------------------------
--
To unsubscribe from cores mailing list please visit http://www.opencores.org/mailinglists.shtml