|
Message
From: Joachim Strombergson<Joachim.Strombergson@i...>
Date: Thu Mar 18 13:33:14 CET 2004
Subject: [oc] "malloc" and "free" implementation in Verilog
Aloha!Quoting abhi_vlsi02@y...: > How to implement dynamic memory allocatuion using Verilog?
What do you mean with dynamic mem allocation with respect to hardware implementation? What is the application/purpose?
Is it cache memory, hw-acceleration of an OS or?
> Where can I get the Verilog code for dynamic memory allocation? > Can anybody give some pointers to some code!
I might be wrong, but I don't think there are that many examples of malloc-type implementations in hardware. What you can do is look at processors that implement TLB-support, which normally contains tables/bits to keep track of allocated pages and some sort of control mechanism (i.e. a FSM) to check requested addresses with the allocated pages.
A malloc is similar, the difference mainly being: (1) You allocate a requested *number* of pages and hand back the address, not check the address agains allocated pages.
(2) You need to handle fragmentation somehow. This is because when you then get free() calls you will end upp with free pages scattered in between allocated pages. The discrete knapsack problem will then unsure that you will not be able to allocate all free space in a given free area, thus leaving more and more single empty pages in between the allocated ones. Basic mem allocation problem.
There are possibly opportunities to handle pointer matching, mem fill, mem copy operations in HW thereby gaining CPU performance, and some CPUs do this, but have never seen a complete, full blown malloc() in HW.
Anybody else on the OC-list with different experience?
-- Med vänlig hälsning, Yours
Joachim Strömbergson - Alltid i harmonisk svängning. VP, Research & Development ---------------------------------------------------------------------- InformAsic AB / Hugo Grauers gata 5B / SE-411 33 GÖTEBORG / Sweden Tel: +46 31 68 54 90 Fax: +46 31 68 54 91 Mobile: +46 733 75 97 02 E-mail: joachim.strombergson@i... Home: www.informasic.com ----------------------------------------------------------------------
|
 |