Compact storage racks for FIFO and LIFO metering systems


What is FIFO?

The “natural queue” method, used in service, in traffic rules, in computer science and other areas, is also reflected in accounting.
Bypassing complex calculations and not taking into account inflation, the accountant can calculate the material resources of the enterprise as they arrive at the warehouse. This accounting method is called FIFO. FIFO is an accounting method that implies the assessment of resources in chronological order. The method is based on the principle “First in, first out” (first-in-first-out): during accounting, it is assumed that the first materials received at the warehouse were used first, the second - second, etc. In practice, resources are written off for production or sale in the volume and at the cost of the first batch, then at the cost and in the volume of the second batch, and so on until all spent resources are accounted for and written off.

Automation system for trade and warehouse accounting. Increase work efficiency, reduce losses and increase profits! Register for free >>

Using the usual method, the accountant does not make any assumptions and takes into account only the volume from the first, second, third and subsequent batches that was consumed in production. The result is complex calculations and the presence of balances for a month or another reporting period from the first batch (at one price), the second batch (at a different price), etc.

Specifics of accounting using the FIFO method

Materials and products in real production cannot be consumed as they are received. An accountant using the FIFO method makes this assumption by writing off resources received at various periods of time at the cost of materials and products that arrived at the warehouse in the first place.

This method can be used at any enterprise (including production, logistics (storage and placement in warehouses), and wholesale trade organizations). The only type of enterprise where it is impossible to use this method are retail trade organizations, where write-offs are made at the exact cost of each product.

In tax and accounting, FIFO makes it possible to significantly speed up the calculation process without waiting for the end of the reporting period, and therefore without overloading the accounting department at the end of the quarter or year. However, the method does not take into account the inflation rate.

FIFO write-off method

The FIFO method makes it possible to estimate actual expenses and trace the path of investments, which, in turn, allows you to evaluate their return on investment. The procedure for using this method is prescribed in the guidelines for accounting of inventories. Thus, when writing off products, certain rules must apply.

In particular:

  • depending on the cost of the first batch of goods, not only receipts and costs are calculated, but also the balance in the warehouse;
  • The FIFO method can be used in its usual or modified form; if the latter is used, the so-called “rolling” cost is taken into account (the average cost, which is recalculated daily at the time of product release);
  • When using the standard FIFO method, product balances are recorded once at the end of each month.

To apply the FIFO method, a company can use almost any accounting software - 1C, BukhSoft, RAUZ, etc. In some cases, simple Excel may be sufficient.

This method is quite convenient, but it also has certain disadvantages. In particular, its use may lead to incorrect calculation of profit and tax base due to the fact that inflation or price fluctuations may not be taken into account in the calculations.

When is FIFO beneficial?

The following disadvantages of the FIFO method can be identified:

  • Lack of inflation accounting: if materials are consumed unevenly, and materials received at a higher cost (increased due to inflation and other factors) can be written off at the price of the first batch, then the final financial results may be overestimated, which causes some consequences.
  • Overestimation of financial indicators and tax payments: FIFO accounting, if in reality materials are consumed unevenly, can lead to an increase in the amount of taxes paid by the enterprise.
  • Incorrect management and planning of enterprise expenses caused by the use of the FIFO method. By receiving inflated data, a manager can draw up an incorrect enterprise development policy, which will lead to negative consequences.

The FIFO method is necessarily taken into account when financial planning and developing company policies for the next period.

Advantages of FIFO:

  • Easy accounting. FIFO significantly speeds up calculations and allows you to get rid of a large number of balances for the last reporting period.
  • Ease of use in enterprises where the first materials to arrive are consumed first. If the “assumption” that an accountant makes using this accounting method actually occurs (for example, if we are talking about perishable goods and materials), using FIFO will be most convenient and profitable.
  • Obtaining the best results when attracting investments. If the head of an enterprise needs to attract investors or obtain a loan for development, the FIFO method will be more convenient and profitable than any other accounting methods.

FIFO principle in warehouse

Let's imagine that your store has purchased three lots of certain goods in the last 3 months. This is what the table with the amounts will look like:

MonthCost priceSale
June10004000
July20004000
August30004000

Using the FIFO principle, it turns out that in the first month you spent 1,000 rubles on purchasing goods and received a profit from it in the amount of 3,000 rubles. The next purchase in July brought you less - about 2,000 rubles. And in the third month, the supplier increased the purchase prices for the products even more and your income was only 1000 rubles.

What we have? When selling goods using the FIFO principle, the products that were delivered first are sold first. This means that if we had not sold all the goods in three months and calculated the profit, then in the case of FIFO the value would be higher due to the low cost of production at the beginning. While with the LIFO principle the opposite picture would have turned out due to the recent inflated prices for goods in August.

The sales method does not affect the number of goods sold or the actual profit received: it allows you to dispose of the goods more practically and accurately. While the accounting statements will differ in case of implementation through FIFO and LIFO.

The FIFO principle is suitable for seasonal businesses that sell clothing or household items and other similar products. However, it is not suitable for companies selling electronic goods. It all depends on your specific business: choose the type of sales that will allow you to sell more goods and get more customers.

Fifo method in accounting

Materials are used unevenly.

As a result, at the end of the month, the accountant must take into account all balances from the first, second, third batch, as well as consumed materials.

Using the usual method, the accountant is forced to calculate the expense and balance for each batch. The balances do not disappear for the next accounting period, and if they have not been spent, the accountant must deal with a large amount of data. More details Accounting by batches of goods >>

Using FIFO, the accountant writes off the first batch at the moment when the company has consumed materials in the amount of the first batch. At the end of the month, he deals with the balances of all batches received at the warehouse, but takes them into account at the cost of the last one. This significantly speeds up and simplifies calculations.

What are LIFO and FIFO methods?

The abbreviation CY stands for Container Yard, which translated from English means “container yard” or “container warehouse”.

This is a specially designated area within a port or terminal where containers are stored until they are loaded onto a ship in the case of export or unloaded from the ship in the case of import.


In some cases, you may see the designation CY / CY in the body of the bill of lading, or in such fields of the bill of lading as Port of Loading and Port of Discharge, usually after the name of the port, for example Houston, TX CY (i.e. .port of Houston container yard, Texas) This designation indicates that the ocean carrier's responsibility either begins (in the case of a port of loading) or ends (in the case of a port of discharge) at the container terminal.

At some ports, the container may be received at a location other than the Container Yard as part of export customs clearance, which will require additional movement to CY, which may incur additional costs. Similarly, this can happen during import clearance - the container can be moved from the Container Yard to another container warehouse (for example, for customs inspection and weighing) or to an intermediate storage area (for a fee or free of charge) until it is loaded onto a container ship with subsequent delivery to the recipient.

In the event that the CY / CY designation is present on the bill of lading, the shipper / consignee is responsible for any movement of the container, and also assumes all costs and risks until the container is delivered to the nominated carrier at the Container Yard or, conversely, collected from Container Yard.

Continuing the topic, it is worth briefly dwelling on 4 more abbreviations that are most often used when quoting shipping rates.

Automation of trade accounting in the online program Class365

Trade accounting has always been considered the most routine job. Due to the large number of calculations and accounting units in the documents, an error may occur, which may take up to several days to find. However, when working with the automated Class365 system, you can avoid errors and loss of time.

To do this, you do not need to purchase an expensive licensed program and train employees in new operating principles. You just need to register in the online system and log into your personal account, where a ready-to-use business automation system is already waiting for you. Class365 allows you to automate all the main processes of your business: warehouse, trade, financial accounting, work with clients, and also speed up the work with issuing documents by 2 times!

Save time, keep records easily and quickly! Get started with the program right now absolutely free!

Join for free today! Trading accounting without routine and errors with Class365!

Principles of processing goods in a warehouse

The Stock Trading warehouse operates using the EME.WMS management system, which regulates the distribution of cargo at all stages of interaction with it, from reception to shipment.

WMS allows you to use three main principles of product processing - FIFO, FEFO and LIFO. Each of these denotes the order of interactions with the cargo.

  • FEFO
    . FEFO (first-expire-first-out) storage configuration involves shipment based on the remaining shelf life. The method is relevant for food, medicine and other goods that have a short shelf life. According to FEFO, cargo is stored like goods on supermarket shelves - everything that has a longer shelf life is placed deeper in the shelves so that goods with a shorter remaining shelf life are shipped first.

    It is important not to confuse this with BBD, which takes into account a recommended storage period rather than a specific one.

  • FIFO
    .

In warehouse logistics

The principles of FIFO and LIFO are also actively used in warehouse logistics[2].

When placing goods into storage, it is necessary to take into account the principle of warehouse processing. If there were several receipts of goods, then you need to decide which goods from which batch will be shipped first. Two options are widely used:

  • The LIFO principle assumes that the goods that arrived last are shipped first; This option is suitable for warehouses with large volumes of goods if the storage areas form a stack.
  • The FIFO principle means priority shipment of goods that arrive first; it is used primarily in warehouses for perishable goods and where the shelf life of goods is important (at the same time, it is the same for different batches of goods: if this is not the case, then they switch to FEFO).

But there are goods and conditions that require other methods: not by date of arrival, but by production date, expiration date or shelf life.

FIFO - LIFO, or Children of the accountant Schmidt

The FIFO (first-in-first-out) principle is similar to FEFO, but the determining factor is not the expiration date, but the time of arrival. Whatever arrives first will be shipped first. In other words, to get to the top of the list, you must first go through it all to open access. According to this system, a queue works - the client who arrived earlier than others is served first.

  • LIFO
    . If LIFO (last-in-first-out) is used, the item that arrived last is shipped first. This principle is used if you need to change the beginning or end of a list without changing anything in the middle. An analogy would be appropriate here with a stack of paper forming a single document, on which you place a couple more sheets on top. This conditional “stack of paper” is called a “stack”.
  • The most commonly used configuration is FIFO - we ship the most recently arrived product, or FEFO - for products with a certain expiration date.

    Warehouse storage conditions

    Our warehouse is of the dry type, the temperature is maintained within 16-25 C°.

    We work with:

    At the same time, we use a WMS setup that allows optimal use of storage volumes. For example, a product of one type is stored in two cells - 5 units in one and 2 units in the other. When an order for 3 units is received, WMS will select the configuration so that 2 units will be taken from the second cell to free it, and 1 unit from the first cell.

    Thanks to the features of our WMS, all work in our warehouse is carried out using Wi-Fi terminals. All employees work in a single information space - employees of the Stock Trading transport department, employees of our client’s logistics department, transport companies, recipients of goods (client’s retail stores). To ensure uninterrupted operation of the warehouse, we have backup power supply and a backup communication channel.

    LIFO method | Last-in, First-out, LIFO

    LIFO method ( English Last-in, First-out, LIFO

    ) is one of the ways to estimate the cost of inventories and the cost of goods sold. Its application implies that inventories are written off to cost of goods sold in the reverse order in which they were placed on the balance sheet. In other words, the newest inventory is written off to cost of goods sold first, and the oldest inventory is reported in ending balances at cost. The LIFO method can be used in both periodic and perpetual inventory systems, which is best illustrated with an example.

    In accounting

    In accounting, FIFO and LIFO are used to determine the value of assets.

    LIFO (acronym for Last In, First Out - last in, first out) is a method of assessing inventory items (inventory items), in which the items that were registered last are removed from accounting first. Currently not used in accounting, and from January 1, 2020, in tax accounting. In conditions of rising prices, it leads to a systemic overestimation of costs and a decrease in the value of the remaining inventory (when prices fall, vice versa).

    Features of accounting using the LIFO method:

    • the actual movement of goods inventories is rarely taken into account;
    • it is assumed that all goods purchased during the period may be offered for sale, regardless of the date of purchase;
    • Closing inventories are valued at the cost of first purchases.

    FIFO (English acronym First In, First Out - first in, first out) is a method of assessing inventory items, in which the first items put on record are removed from the register.

    Suppose you bought two printer cartridges for 5 rubles each, then two more of the same for 6. One cartridge was used up. It doesn’t matter to the storekeeper which one to give: they are the same. But the accountant is interested in the total cost of what is in the warehouse: the cost of the remaining three cartridges according to the LIFO method will be 16 rubles, according to the FIFO method 17 rubles.

    Example

    A company operating in the retail trade of building materials carried out the following transactions for the purchase and sale of facing bricks during the 4th quarter.

    * when purchasing facing bricks, its cost is indicated, and when selling, the selling price is indicated

    The balance of facing bricks as of October 1 was 20,000 pieces at a cost of 3.05 USD. a piece.

    Periodic inventory accounting system using the LIFO method

    When calculating the cost of goods sold in the 4th quarter, it is necessary to write off inventories in the reverse order in which they were placed on the balance sheet. The last batch of deliveries for December 6th will be written off first, then sequentially the deliveries received on November 13th and October 5th, and lastly the inventories from the balances at the beginning of the 4th quarter. The volume of products sold in the reporting period amounted to 247,000 pieces of facing bricks, and 255,000 pieces were purchased, including balances. Thus, the remaining bricks at the end of the 4th quarter will be 27,000 units. (380000-253000).

    40000+38000+45000+125000+55000+50000 = 353000 pcs.

    20000+120000+140000+100000 = 380000 pcs.

    In accordance with the LIFO method, delivery lots for December 6 and November 13 will be completely written off to cost of goods sold in the amount of 240,000 units (100,000 + 120,000), and from the delivery lot for October 5, 113,000 units (353,000-240,000) will be written off. Consequently, the cost of goods sold in the 4th quarter will be 1,220,250 USD.

    100000*3.70+140000*3.45+113000*3.25 = 1220250 USD

    The cost of the remaining inventory as of December 31 will be $83,750.

    20000*3.05+7000*3.25 = 83750 USD

    Continuous inventory accounting system using the LIFO method

    The continuous accounting system involves recalculating the cost of the remaining inventory and the cost of goods sold upon the fact of each operation.

    October 5

    . Warehouse remains of facing bricks will amount to 140,000 units. (20000+120000) at a cost of 607000 USD.

    20000*4.25+120000*4.35 = 607000 USD

    17 October

    .

    Fifo and Lifo method

    The cost of products sold will be calculated based on the cost of facing bricks from the latest delivery batch at the moment (for October 5) 3.25 USD. per piece and will amount to 130,000 USD.

    40000*3.25 = 130000 USD

    Warehouse balances will amount to 100,000 pieces (140,000-40,000) at a cost of 321,000 USD.

    (120000-40000)*3.25+20000*3.05 = 321000 USD

    the 25th of October

    . The cost of products sold will also be determined based on the last delivery batch and will amount to 123,500 USD.

    38000*3.25 = 123500 USD

    The remaining inventory in the warehouse will be 62,000 units. (100,000-38,000) at a cost of 197,500 USD.

    (120000-40000-38000)*3.25+20000*3.05 = 197500 USD

    November 4

    . The balance of the delivery batch for October 5 in the amount of 42,000 units (120,000-40,000-38,000) and 3,000 units from the balance at the beginning of the quarter will be completely written off to the cost of products sold, which will amount to 145,650 USD.

    42000*3.25+3000*3.05 = 145650 USD

    The balance of inventories, in turn, will be 17,000 pieces (62,000-45,000) at a cost of 51,850 USD.

    17000*3.05 = 51850 USD

    the 13th of November

    . The balance of facing bricks in the warehouse will be 157,000 units. (17000+140000), and its cost is 534850 USD.

    140000*3.45+17000*3.05 = 534850 USD

    November 25

    . The cost of products sold will be calculated based on the price of the last, at that moment, delivery batch and will amount to 431,250 USD.

    125000*3.45 = 431250 USD

    The remaining inventory in the warehouse will be 32,000 units. (157000-125000) at a cost of 103600 USD.

    (140000-125000)*3.45+17000*3.05 = 103600 USD

    December 6

    . The balance of facing bricks in the warehouse will be 132,000 units. (100000+32000) at a cost of 473600 USD.

    100000*3.70+15000*3.45+17000*3.05 = 473600 USD

    December 17

    . The cost of products sold is calculated based on the cost of one facing brick from the delivery batch for December 6 and will amount to 203,500 USD.

    55000*3.70 = 203500 USD

    The remaining inventory in the warehouse will be 77,000 units. (132000-55000) at a cost of 270100 USD.

    45000*3.70+15000*3.45+17000*3.05 = 270100 USD

    December 28th

    . The balance of the delivery batch for December 6 and 5,000 units will be fully attributed to the cost of products sold. from the delivery batch for November 13, which will amount to 183,750 USD.

    45000*3.70+5000*3.45 = 183750 USD

    The inventory balance will be 27,000 units. (77000-50000) at a cost of 86350 USD.

    10000*3.45+17000*3.05 = 86350 USD

    The use of the LIFO method in a continuous accounting system showed that the cost of goods sold in the 4th quarter amounted to 1,217,650 USD. (130000 + 123500 + 145650 + 431250 + 203500 + 183750), and the cost of the remaining inventory is 86350 USD.

    So, we can conclude that the results of applying the LIFO method in a periodic and continuous inventory accounting system may differ.

    An example of inventory write-off using variations of the FIFO method

    Let's consider what differences in the calculation were observed when using two variations of the FIFO inventory write-off method.

    Example 1. Basic FIFO method.

    In the first month, the company purchased 30 flower pots at a price of 150 rubles per piece. In the second month there were two more deliveries of goods: the first - in the amount of 15 pieces at a price of 120 rubles per pot, the second - in the amount of 5 pieces at a price of 130 rubles per unit. Upon request, the storekeeper must issue 48 flower pots. In its activities, the company uses the FIFO inventory valuation method.

    • First of all, it is necessary to calculate the average cost of goods to be issued: Sebest-tsr. = 30*150 + 15*120 + 3*130 = 4500 + 1800 + 390 = 6690.
    • The next step is to determine the average cost of one flower pot: St = 6690 / 48 = 139.38 rubles.

    Accordingly, the balance in the warehouse will be 2 flower pots, costing 130 rubles each.

    Example 2. Rolling FIFO method.

    Using the data from the example above, the cost was calculated using the sliding FIFO method:

    • The cost of flower pots that will remain in the organization’s warehouse will be determined as follows: 2*130 = 260 rubles.
    • The cost of flower pots, which are written off from the organization’s balances, will be calculated as follows: 30*150 + 15*120 + 5*130 – 260 = 4500 + 1800 + 650 – 260 = 6690 rubles.

    Based on the calculations made, it can be noted that when calculating the cost, the same results were obtained, regardless of which model of the FIFO method was applied. When using a rolling model, there is no need to determine whether a product belongs to a specific batch; it is enough to know the total amounts of deliveries. However, in the case when the company uses the first write-off method, it is important to know from which delivery the goods are being retired.

    Thus, today only three options for writing off inventories are available for accounting and tax accounting of companies.

    The LIFO method has been discontinued in accounting since 2008 (Order of the Ministry of Finance No. 26n dated March 26, 2007), while the ban on the use of this method in tax accounting was introduced in 2020 (amendments to Articles 254, 268 of the Tax Code of the Russian Federation).

    Experts will help you understand the methodology for estimating reserves.

    Lecture 8 Inventory accounting

    In accordance with IFRS 2 “Inventories”, inventories

    these are the assets:

    - held for sale in the normal course of business;

    - or in the form of raw materials or materials intended for use in the production process or in the provision of services;

    Inventory includes acquired assets intended for further resale and are not subject to further processing, which would entail a change in its physical form.

    Inventories are acquired assets that are subject to further processing, which will entail a change in its physical form, as well as assets manufactured at a given enterprise.

    Industrial inventories include:

    — stocks of raw materials, materials, purchased semi-finished products and components, structures and parts, fuel, containers and packaging materials, spare parts, other materials intended for use in the production or performance of work and services;

    - unfinished production;

    - finished products, goods intended for sale as part of the entity’s activities.

    A continuous inventory accounting system is a system in which a detailed reflection of the receipts and disposals of inventories is carried out in accounts at the time of transactions. Throughout the reporting period, the availability of inventories and the cost of sold (used) inventories are known, which ensures control of the availability of inventories at any time. The value of inventories at the end of the reporting period is determined by the usual method - by displaying balances in inventory accounts. When using the current inventory method, balances and turnover in inventory accounts change after each transaction is completed,

    With a periodic accounting system, daily records of receipts and expenditures of inventories are not maintained. The actual availability of inventories is determined based on the results of the inventory.

    When using the periodic inventory method, the balance and turnover of inventory accounts change after the inventory is taken and the actual availability of goods is determined.

    Inventory inventory consists of checking their actual availability. To carry out the inventory, an order is issued and a commission is appointed. The inventory is carried out in the presence of materially responsible persons, the identified results are entered into the inventory list. Inventory list at the end of the inventory

    signed by all members of the commission and the storekeeper.

    Before the inventory begins, the storekeeper writes a receipt stating that all materials have been capitalized or written off and documents for receipts and expenses have been submitted to the accounting department. For identified deviations (shortages or surpluses), a matching sheet is filled out in the accounting department.

    Based on the comparison sheet and the decision of the head of the organization, the following entries are made in the accounting department:

    Dt 1310,1350 Kt 6280 - surplus materials and inventories are accounted for at actual cost;

    Dt 7210 K1310.1350 - write-off of shortage of materials within the limits of natural loss;

    Dt 7470 K 1310.1350 - the actual cost of materials attributed to the storekeeper is written off;

    Dt 1254 Kt 6280 - market value of shortage of materials;

    Dt 1254 Kt 3130 - the amount of VAT to be reimbursed by the culprit;

    Dt 1010, 3350 Kt 1254 - compensation by the culprit for the amount of the shortage (to the cash desk, according to salary).

    In accordance with IFRS 2, inventories must be measured at the lower of cost and net realizable value.

    Possible net realizable value of goods is equal to the expected selling price in the normal course of business minus the costs of performing work and organizing the sale.

    The cost of inventory is made up of three elements:

    — acquisition costs (purchase price, import duty, commissions paid to supply organizations, transportation and procurement costs);

    — processing costs (direct and overhead production costs);

    — other costs (trade discounts, refund of overpayments, etc.).

    When forming the cost price, it is allowed to use

    two accounting methods:

    - standard cost method

    for production organizations;

    - retail price method - for retail organizations.

    According to IFRS 2 “Inventories”, the cost of inventories is determined by one of the following methods:

    — Weighted average cost method

    Weighted average price = cost (receipt + balance) / quantity (remaining + receipt)

    — Fifo-assumes the write-off of materials at the cost of the first purchases in the reporting period, taking into account the cost of materials registered at the beginning of the reporting period.

    -Specific identification - involves an assessment based on the actual cost of each batch, used in organizations with a small range of materials intended for special orders.

    The choice of valuation method is established in the accounting policy of the entity. A change in method is possible only if there are serious reasons, and the reasons for the change must be explained in the explanatory note to the annual financial statements.

    Let's consider the disadvantages and advantages of various methods for assessing materials (comparison of methods):

    fifoWeighted average costSpecific identification
    flawsLeads to outdated production costs, inflates profits and complicates inventory accountingLeads to inventory and production cost estimates that differ from actual valuesThe labor-intensive inventory process leads to additional costs
    advantagesProduces a realistic assessment of inventoryEasy to use, minimal number of calculationsLeads to a real estimate of inventory and production costs

    Methods for valuing inventories

    Method MethodMethod
    weighted averageFIFO methodspecific
    costidentification
    Leads toDuring the period of constantAllows the most
    levelingprice increases applicationaccurately determine
    factor influenceFIFO method resultscost price
    rising and falling pricesto the highestimplemented
    to identicallevel of net income,goods. He is the most
    commodity-duringaccurately reflects
    inventoriesdisinflation leads tothe amount of net
    during the reporting periodlowestincome
    periodlevel of net income.

    When accepting materials to the warehouse, the storekeeper checks the quantity, quality, and range of materials. If, upon acceptance, the actual availability, quantity, and assortment corresponds to the data of accompanying documents, contracts, and supplier invoices, then a receipt order is issued at the warehouse.

    If, upon acceptance of materials, discrepancies with the supplier’s documents are found (shortages, surpluses, misgrading), or if the materials were received without accompanying documents from the supplier, then a materials acceptance certificate is issued.

    Materials are spent on the manufacture of products, performance of work and provision of services, as well as for other purposes (maintenance and repair of equipment, premises, etc.).

    Materials are released into production according to a limit-fence card (LZK), which is a cumulative document and is opened for a month in two copies, one is transferred to the warehouse, the other to the accounting department. At the beginning of the month, it indicates the limit for the month, then the materials are released during the month within the established limit.

    A requirement is issued for an above-limit or one-time supply of materials. Above-limit supply of materials is carried out with the permission of the administration.

    When transferring materials from workshop to workshop, from warehouse to warehouse, an invoice is issued for the internal movement of materials.

    Accounting for materials and materials in stock is carried out by materially responsible persons in materials accounting cards. A card opens for each name of materials.

    How does FIFO work?

    FIFO is one of the key elements of digital technology. This is a first-in-first-out memory. As an FPGA FIFO developer, I'm surrounded by everything. Actually, all I do is take data from one FIFO and transfer it to another. But how does it work? Modern CAD systems, of course, already have ready-made elements, Altera has wonderful mega-functions. Xilinx has a Core Generator. But what to do if something doesn’t suit you in standard solutions? There is only one answer - figure it out and write it yourself. There are a large number of articles about FIFO on the Internet, and I once came across a very good and sensible article. Unfortunately, I haven't found it now. Next is my personal experience in creating and using the FIFO component. The finished element is located on Github in the fpga_components project. This component was required for several reasons:

    1. FIFO XIlinx cannot work in retransmit mode - this is the main reason
    2. FIFO Xilinx requires the creation of a component with specified parameters - we have too many different components.
    3. The Xilinx FIFO contains a bug - if a reset signal arrives at the same time as a data write signal, then one word is stuck in the FIFO. Of course, we got around this, but it’s still unpleasant.

    So what is FIFO? In the general case, this is a dual-port memory, two address counters and two machines for reading and writing data.

    One of the main uses of a FIFO is to transfer data from one clock frequency to another. This defines such a scheme. With one clock frequency for writing and reading, the machines can be simplified.

    Let's look at the external ports of the FIFO component:
    cl_fifo_m12
    component cl_fifo_m12 is generic( FIFO_WIDTH : in integer:=64; - FIFO width FIFO_SIZE : in integer:=4096; - FIFO size FIFO_PAF : in integer:=16; - PAF flag trigger level FIFO_PAE : in integer:=544 — PAE flag activation level); port( - reset reset_p : in std_logic; - 1 - reset - write clk_wr : in std_logic; - clock frequency data_in : in std_logic_vector( FIFO_WIDTH-1 downto 0 ); - data data_en : in std_logic; - 1 - write to fifo flag_wr : out bl_fifo_flag; - fifo flags, synchronous with clk_wr cnt_wr : out std_logic_vector( 15 downto 0 ); - word counter - reading clk_rd : in std_logic; - clock frequency data_out : out std_logic_vector( FIFO_WIDTH-1 downto 0 ); - data data_rd : in std_logic:='0′; - 1 - reading from fifo, data on the second clock flag_rd : out bl_fifo_flag; - fifo flags, synchronous with clk_rd cnt_rd : out std_logic_vector( 15 downto 0 ); - word counter rt : in std_logic:=' 0′; — 1 — transition to the beginning at an arbitrary moment rt_mode : in std_logic:='0′ — 1 — transition to the beginning after reading the entire contents of the FIFO ); end component; Component setup:

    • FIFO_WIDTH – FIFO width, can be any.
    • FIFO_SIZE – the number of words in the FIFO, this is a power of two, from 64 to 65536. If you need a larger size, then you need to make a composite FIFO.
    • FIFO_PAF – level of activation of the almost full FIFO flag.
    • FIFO_PAE – level of activation of the almost empty FIFO flag; more about flags later.

    The names of the ports are quite obvious, a few comments on the flags:
    FIFO flags are transmitted by the bl_fifo_flag type; Type Definition:

    type bl_fifo_flag is record ef : std_logic; — 0 — FIFO empty pae : std_logic; — 0 — FIFO almost empty hf: std_logic; — 0 — FIFO is half full paf: std_logic; — 0 — FIFO almost full ff : std_logic; — 0 — FIFO full ovr: std_logic; - 1 - write to full FIFO und : std_logic; — 1 — reading from an empty FIFO end record; Please note that negative logic is used. Learned? Yes, I’m also one of those dinosaurs who worked with TTL on the 155, 533, 1533 series and separate FIFO microcircuits. So these flags are familiar to me, they were made many years ago and are still in use.

    The ef flag signals that the FIFO is empty. If ef=1, then one word can be read from the FIFO. The pae flag signals that the FIFO is almost empty. Almost how much is determined by the FIFO_PAE parameter. If pae=1, then no more than FIFO_PAE words can be read from the FIFO. The hf flag signals that the FIFO is half full. The paf flag signals that the FIFO is almost full. Almost how much is determined by the FIFO_PAF parameter. If paf=1, then no more than FIFO_PAF words can be written to the FIFO. Flag ff – FIFO full. If ff=0, then you cannot write to the FIFO. The ovr flag is an overflow. If ovr=1, then this means that a write to the full FIFO occurred. Flag und – underflow. If und=1, then this means that a read occurred from an empty FIFO.

    It is quite obvious that when writing to the FIFO, we must write the word to dual-port memory and increase the write counter. Or enlarge first and then record. And during a read operation, you need to fix the data at the output and increase the read counter. But then the following questions need to be resolved:

    1. How to determine whether a FIFO is complete or not complete, i.e. Is it possible to write to it?
    2. How to determine if the FIFO is empty or not empty? Those. Is it possible to read from it?
    3. How to correctly form the flags PAE, PAF, HF?
    4. What is the number of words in FIFO?

    It is quite obvious that the answers to all these questions are in the analysis of address counters for writing and reading. But these meters operate at different frequencies. This is where implementation differences begin. I used a symmetrical scheme for transferring counter values ​​to another clock domain. As a result, it turned out that each of the read-write machines has the value of its own counter and the delayed value of another counter. From these values, the machines form their flags and the number of words in the FIFO. This can be represented in a block diagram:

    It must be clearly understood that the reclocking node (in the project this is the ctrl_retack_counter_m12 component) transmits data with a delay of several clock cycles. Therefore, the FIFO states also change with a delay. For example, if the FIFO is empty and one word is written to it, then the ef=1 flag will appear with some delay. The same applies to the word count outputs in the FIFO. For example, if 16 words are written to an empty FIFO, then during the writing process the output cnt_wr will take values ​​0,1,2,3, ... 16 (this is if the FIFO is not read), but the output cnt_rd will take values ​​such as: 0, 5, 8, 12, 16. The exact order will depend on the frequency ratio and cannot be predicted. This is a fundamental property of FIFO that operates at different frequencies. Although, depending on the synchronization scheme, there may be various nuances.

    The determination of an empty and a full FIFO is made by analyzing the address counters. Moreover, I have two addresses for writing (current and next) and two addresses for reading, also current and next. In the cl_fifo_control_m12 component these are the signals w_adr, w_next_adr and r_adr, r_next_adr; The relationship of addresses in various states is presented in the figures below.

    In the initial state w_adr=0, r_adr=0, w_next_adr=1, r_next_adr=1. If w_adr=r_adr, then the FIFO is empty.

    When writing, the data word is written to w_adr and the write address is incremented.

    After a few years, the value of w_adr will be transferred to w_adr_to_rd (will go to the clk_rd clock domain) and if r_adr and w_adr_to_rd do not match, the flag ef=1 will be set, i.e. a data word can be read from the FIFO. However, one word is not enough; to obtain a high transmission speed, you need to work with a block of data. And here you need to use the PAE flag. When FIFO_PAE words are written to the FIFO, the pae=1 flag will be set and the data block can be read immediately. This is the main mode of working with a DMA channel.

    If the write speed is greater than the read speed, then the write address will catch up with the read address:

    In this case, w_next_adr will be equal to r_adr, or rather r_adr_to_wr (we can only compare values ​​in our clock domain). This means that the FIFO is full and you cannot write further, so as not to spoil the already written data. It should be noted that this is a common situation for connecting an ADC. We call this mode one-time collection via FIFO. In this mode, the ADC writes data at high speed to the FIFO, and the slow processor reads this data. At the same time, we know that only the data block that corresponds to the FIFO size will be valid. Typically, the DMA channel is programmed for this size. After reading the data, the FIFO is reset and everything repeats again. In this mode, it is fundamentally important that writing to the full FIFO does not spoil the previous data.

    If you need to write data in blocks, then you must use the PAF flag. If paf=1, then FIFO_PAF words can be written to the FIFO.

    The values ​​of the PAE and PAF flags must be selected from the requirements of the DMA controller to which the FIFO is connected. For example, for PCI Express we use a data block of 4 KB in size. This is 256 words of 128 bits. I set the PAE flag size to 272. That is. a little more than 256. I do this on purpose to prevent the FIFO from emptying. Well, I don’t trust flag generation schemes.

    How is the number of words in a FIFO determined? Everything is quite simple - you need to subtract the read address from the write address. The address is a multiple of a power of 2, so the subtraction will be modulo 2^N; Since we have two pairs of addresses, we will also have two values ​​for the number of words in one FIFO (maybe this has something to do with quantum mechanics?).

    The values ​​of the PAE and HF flags (as read) are formed from r_cnt. The PAF and HF values ​​(by entry) are formed from w_cnt.

    The main reason why I had to develop my own FIFO component is the need to implement a cyclic mode for operation on the DAC. In this mode, a data block is written; it can be of any size, of course not exceeding the FIFO size. And then reading begins, and after the last written word is issued, the transition to the first word immediately occurs. This allows you to connect a slow processor to a fast DAC. The FIFO component has two inputs for cyclic mode. rt_mode=1 means that after issuing the last written word, you need to go to address zero.

    But the rt input is needed for a slightly different purpose. The presence of rt=1 allows the FIFO to be moved to address zero at an arbitrary point in time. Sometimes we use this too.

    The fpga_components project provides two FIFOs:

    • cl_fifo_x64_v7
    • cl_fifo_m12

    cl_fifo_x64_v7 was developed and published quite a long time ago. It has also been used for a long time and has proven its performance. It uses a component generated by Core Generator as a dual-port memory. Different FIFO sizes require their own components, for example, there are four components in the fpga_components\src\fifo\fifo_v7\coregen directory

    • ctrl_dpram512x64_v7
    • ctrl_dpram1024x64_v7
    • ctrl_dpram8192x64_v7
    • ctrl_dpram32768x64_v7

    And this is all only for a 64-bit wide bus.
    Other tires and other sizes require their own components. We made them little by little and by now we have a large pile that is already inconvenient to work with. Alexander Kapitanov ( capitanov ) drew attention to this and proposed an elegant solution - to make a fully synthesizable FIFO. He implemented this in his project: github.com/capitanov/adc_configurator Component: ctrl_fifo_config. The main idea is to use the following VHDL construction: type RAM is array (integer range <>) of std_logic_vector(DATA_WIDTH-1 downto 0); signal Mem : RAM (0 to DATA_DEPTH-1); This design will be synthesized into dual-port memory. The idea is beautiful and as a result of finalizing cl_fifo_x64_v7 we got FIFO cl_fifo_m12. It is not enough to write a FIFO; you also need to check its operation. For testing, the approach adopted during the development of PROTEQ is used, which can be read about in my previous article.

    There is a component tb_00 which has configurable parameters.

    tb_00

    component tb_00 is generic( max_time : in time:=100 us; — maximum test time period_wr : in time; — writing frequency period period_rd : in time; — reading frequency period fifo_size : in integer; — FIFO size FIFO_PAF : in integer; — PAF flag trigger level FIFO_PAE : in integer; — PAE flag trigger level max_fifo0_pkg : in integer — number of packets to receive);
    end component; It allows you to check the flow of data through the FIFO at various ratios of clock frequencies and levels of the PAE and PAF flags. There are also test case components:

    • tc_00_01 – will check the case when the write speed is greater than the read speed.
    • tc_00_02 – and this is when the read speed is greater than the write speed.

    As a result, the following test run report is generated: Global fifo_12 TC log: tc_00_01 PASSED tc_00_02 PASSED Of course, each test also saves its own report.
    For example this:

    tc_00_01.log

    # KERNEL: FIFO 0 - PKG= 1 6310 ns 0 ns ERROR: 0 SPEED: 0 # KERNEL: FIFO 0 - PKG= 2 12022 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 3 17734 ns 5712 NS Error: 0 Speed: 1368 # Kernel: FIFO 0 - PKG = 4 23446 NS 5712 NS Error: 0 Speed: 1368 # Kernel: Fifo 0 - PKG = 5 29158 NS 5712 NS Error: 0 Speed: 1368 # Kernel: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fifo: Fife: — PKG= 6 34870 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 7 40582 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 8 46294 ns 5712 ns ERROR: 0 SPEED : 1368 # KERNEL: FIFO 0 - PKG= 9 52006 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 10 57718 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 11 63430 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 12 69142 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 13 74854 ns 5712 ns ERROR: 0 SPEED: 1368 # K ERNEL: FIFO 0 - PKG= 14 80566 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 15 86278 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 16 91990 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 17 97702 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 18 103414 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PK G= 19 109126 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 20 114838 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 21 120550 ns 5712 ns ERROR: 0 SPEED: 1368# KERNEL: FIFO 0 - PKG= 22 126262 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 23 131974 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 24 13768 6 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 25 143398 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 26 149110 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 27 154822 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 28 160534 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 29 166246 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 30 171958 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 31 177670 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 32 183382 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 33 189094 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 34 194806 ns 5712 ns ERROR: 0 SPEED: 1368 # K ERNEL: FIFO 0 - PKG= 35 200518 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 36 206230 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 37 211942 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 38 217654 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 39 223366 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG = 40 229078 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 41 234790 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 42 240502 ns 5712 ns ERROR: 0 SPE ED: 1368#KERNEL : FIFO 0 - PKG= 43 246214 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 44 251926 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 45 257638 ns 5712 ns ERROR 0 —P.K.G. = 48 274774 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 49 280486 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 50 286198 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 51 291910 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 52 297622 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 53 3033 34 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 54 309046 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 55 314758 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 56 320470 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 57 326182 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 58 331894 ns 5712 ns ERROR: 0 SPEED : 1368 # KERNEL: FIFO 0 - PKG= 59 337606 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 60 343318 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 61 349030 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 62 354742 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 63 360454 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 64 366166 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 65 371878 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 66 377590 ns 5 712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 67 383302 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 68 389014 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - P KG= 69 394726 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 70 400438 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 71 406150 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 72 411862 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 73 417574 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 74 42328 6 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 75 428998 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 76 434710 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 77 440422 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 78 446134 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG= 79 451846 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 80 457558 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 81 463270 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 82 468982 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 83 474694 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 84 480406 ns 5712 ns ERROR: 0 SPEED: 1368 # K ERNEL: FIFO 0 - PKG= 85 486118 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 86 491830 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 87 497542 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 88 503254 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 89 508966 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG = 90 514678 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 91 520390 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 92 526102 ns 5712 ns ERROR: 0 SPE ED: 1368#KERNEL : FIFO 0 - PKG= 93 531814 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 94 537526 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 95 543238 ns 5712 ns ERROR 0 —P.K.G. = 98 560374 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 99 566086 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=100 571798 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=101 577510 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=102 583222 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=103 5889 34 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=104 594646 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=105 600358 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=106 606070 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=107 611782 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=108 617494 ns 5712 ns ERROR: 0 SPEED : 1368 # KERNEL: FIFO 0 - PKG=109 623206 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=110 628918 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=1 11 634630 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=112 640342 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=113 646054 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=114 651766 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=115 657478 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=116 663190 ns 5 712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=117 668902 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=118 674614 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — P KG= 119 680326 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=120 686038 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=121 691750 ns 5712 ns ERROR: 0 SPEED: 1368# KERNEL: FIFO 0 — PKG=122 697462 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=123 703174 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=124 70888 6 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=125 714598 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=126 720310 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=127 726022 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=128 731734 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=129 737446 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=130 743158 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=131 748870 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=132 754582 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=133 760294 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=134 766006 ns 5712 ns ERROR: 0 SPEED: 1368 # K ERNEL: FIFO 0 — PKG=135 771718 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=136 777430 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=137 783142 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=138 788854 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=139 794566 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG =140 800278 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=141 805990 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=142 811702 ns 5712 ns ERROR: 0 SPE ED: 1368#KERNEL : FIFO 0 — PKG=143 817414 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=144 823126 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=145 828838 ns 5712 ns ERROR : 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=146 834550 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=147 840262 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 —P.K.G. =148 845974 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=149 851686 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=150 857398 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=151 863110 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=152 868822 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=153 8745 34 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=154 880246 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=155 885958 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=156 891670 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=157 897382 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=158 903094 ns 5712 ns ERROR: 0 SPEED : 1368 # KERNEL: FIFO 0 - PKG=159 908806 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=160 914518 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=1 61 920230 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=162 925942 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=163 931654 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=164 937366 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=165 943078 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=166 948790 ns 5 712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=167 954502 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=168 960214 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — P KG= 169 965926 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=170 971638 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=171 977350 ns 5712 ns ERROR: 0 SPEED: 1368# KERNEL: FIFO 0 — PKG=172 983062 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=173 988774 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=174 99448 6 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=175 1000198 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=176 1005910 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=177 1011622 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=178 1017334 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=179 1023046 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=180 1028758 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=181 1034470 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=1 82 1040182 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=183 1045894 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=184 1051606 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=185 1057318 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=186 1063030 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=187 1068742 ns 5 712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=188 1074454 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=189 1080166 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - P KG=190 1085878 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=191 1091590 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=192 1097302 ns 5712 ns ERROR: 0 SPEED: 1368# KERNEL : FIFO 0 - PKG=193 1103014 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=194 1108726 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=195 111443 8 ns 5712 ns ERROR : 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=196 1120150 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=197 1125862 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG =198 1131574 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=199 1137286 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=200 1142998 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=201 1148710 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=202 1154422 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=203 11 60134 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=204 1165846 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=205 1171558 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL : FIFO 0 — PKG=206 1177270 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=207 1182982 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=208 1188694 ns 571 2 ns ERROR: 0 SPEED : 1368 # KERNEL: FIFO 0 - PKG=209 1194406 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=210 1200118 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG =211 1205830 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=212 1211542 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=213 1217254 ns 5712 ns ERROR: 0 SPEED: 13 68# KERNEL: FIFO 0 — PKG=214 1222966 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=215 1228678 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=216 1234390 n s 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=217 1240102 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=218 1245814 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG= 219 1251526 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=220 1257238 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=221 1262950 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=222 1268662 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=223 1274374 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=224 128 0086 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=225 1285798 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=226 1291510 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=227 1297222 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=228 1302934 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=229 1308646 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=230 1314358 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=231 1320070 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=2 32 1325782 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=233 1331494 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=234 1337206 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=235 1342918 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=236 1348630 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=237 1354342 ns 5 712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=238 1360054 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=239 1365766 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - P KG=240 1371478 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=241 1377190 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=242 1382902 ns 5712 ns ERROR: 0 SPEED: 1368# KERNEL : FIFO 0 - PKG=243 1388614 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=244 1394326 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG=245 140003 8 ns 5712 ns ERROR : 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=246 1405750 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=247 1411462 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 - PKG =248 1417174 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=249 1422886 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=250 1428598 ns 5712 ns E RROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=251 1434310 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=252 1440022 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=253 14 45734 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=254 1451446 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: FIFO 0 — PKG=255 1457158 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL : FIFO 0 — PKG=256 1462870 ns 5712 ns ERROR: 0 SPEED: 1368 # KERNEL: Data reception completed: 1463200 ns # KERNEL: FIFO 0 # KERNEL: Received packets: 256 # KERNEL: Correct: 256 # KERNEL: Incorrect: 0 # KERNEL: Total number of errors: 0 # KERNEL: Transfer speed: 1368 MB/s # KERNEL: # KERNEL: # KERNEL: # KERNEL: TEST finished successfully # KERNEL:
    If necessary, tests will be supplemented.
    I would like to point out that I use the PCK_FIO package to output text to the console. It greatly simplifies text output. For example, the output looks like this:

    fprint( output, L, “Data reception completed: %r ns\n”, fo(now) ); fprint( output, L, "FIFO 0 \n" ); fprint( output, L, "Packets received: %d\n", fo( rx0_result.pkg_rd ) ); fprint( output, L, " Correct: %d\n", fo( rx0_result.pkg_ok ) ); fprint( output, L, " Errors: %d\n", fo( rx0_result.pkg_error ) ); fprint( output, L, » Total number of errors: %d\n", fo( rx0_result.total_error ) ); fprint( output, L, » Transfer rate: %r MB/s\n\n", fo( integer(rx0_result.velocity) ) ); It's similar to C.

    As a result, I think that the result is an elegant component that is convenient enough for practical work.

    FIFO and LIFO methods in accounting

    Entries in cards are made by the storekeeper in quantitative terms, based on incoming and outgoing documents. After each entry, the remaining materials are indicated.

    Acceptance of warehouse documents from the storekeeper is carried out by a register accountant.

    Upon receipt from the warehouse, documents are carefully checked. At the end of the month, the remaining material reserves from the cards are transferred to the “Book of remaining materials”.

    Accounting for materials in the accounting department. Based on grouped and verified documents, grouping and accumulative statements are filled out in the accounting department. The consolidated register for accounting for materials in the accounting department in monetary terms is the “Statement of Material Movements.” It summarizes data on the balances and movement of inventories in warehouses and materially responsible persons. Data is transferred to it from accumulative statements on the movement of materials for the reporting month, or from material reports of financially responsible persons.

    To account for assets intended for sale in the normal course of business, or in the process of production for sale, or in the form of raw materials or materials intended for use in the production process or in the provision of services, the accounts of subsection 1300 “Inventories” are intended: 1310 “Raw materials and materials” ", 1320 "Finished goods", 1330 "Goods", 1340 "Work in progress", 1350 "Other inventories"

    Accounting for receipt of goods and materials:

    Dt 1310, 1330,1350 Kt 3310 - from suppliers based on an invoice.

    Dt 1420 Kt 3310 - VAT on purchased materials, to be reimbursed from the budget.

    Dt 1310, 1330, 1350 Kt 1250 - purchased from accountable amounts according to advance reports.

    Dt 1310, 1330, 1350 Kt 6220 - free of charge from other persons

    Dt 1310,1330,1350 Kt 6280 - for the amount of capitalized surplus

    Dt 1310,1330,1350 Kt 5020 - contributions to the authorized capital from the founders

    Dt 1310.1350 Kt 8010.8030 - return of saved leftover materials from production.

    Material consumption accounting:

    Dt 2930 Kt 1310.1350 - for the construction of new fixed assets;

    Dt 8010 Kt 1310.1350 - to main production;

    Dt 8030 Kt1310,1350 - to auxiliary production;

    Dt 8040 Kt 1310.1350 - for production maintenance;

    Dt 7110 Kt 1310.1350 - for servicing the implementation process;

    Dt 7210 Kt 1310.1350 - for general and administrative purposes, write-off of material losses

    Dt 7470 Kt 1310.1350 - write-off of materials and goods as a result of gratuitous transfer, natural disasters and sales.

    Date added: 2017-06-02; ;

    12/05/2013 17:20 Write-off of sold goods using the FIFO method in the 1C: Accounting 8 program, ed. 3.0.

    In the Directory of Business Operations. 1C:Accounting added a practical article “Write-off of goods sold using the FIFO method”, which discusses an example where an organization uses the FIFO method to calculate the cost of goods sold.

    Clause 16 of PBU 5/01 “Accounting for inventories” (approved by order of the Ministry of Finance of Russia dated 06/09/2001 No. 44n) (hereinafter referred to as PBU 5/01) stipulates that when releasing inventories (except for goods accounted for by sales value) into production and other disposal, their assessment is carried out in one of the following ways:

    • at the cost of each unit;
    • at average cost;
    • at the cost of the first acquisition of inventories (FIFO method).

    Estimation at the cost of the first acquisition of inventories (FIFO method) is based on the assumption that inventories are used within a month or another period in the sequence of their acquisition (receipt), i.e. inventories that are the first to enter production (sale) must be valued at the cost of the first acquisitions, taking into account the cost of inventories listed at the beginning of the month. When applying this method, the assessment of inventories in stock (in warehouse) at the end of the month is made at the actual cost of the latest acquisitions, and the cost of goods, products, works, services sold takes into account the cost of earlier acquisitions (clause 19 PBU 5/01).

    Please pay attention! At the time of publication of this article, there is a draft Federal Law No. 375042-6 “On amendments to Chapter 25 of Part Two of the Tax Code of the Russian Federation and the recognition as invalid of certain provisions of legislative acts of the Russian Federation (regarding simplification of tax accounting)”, in paragraphs. "c" clause 2 of Art. 1 of which indicates the abolition of the LIFO method for tax accounting purposes.

    The FIFO method uses batch accounting, which assumes that goods arrive at the warehouse in the form of separate batches, which differ from each other in certain properties: date, receipt document, etc. Batch accounting assumes that each batch of the same product is accounted for in the warehouse separately.

    In the 1C:Accounting 8 program, a consignment of goods means goods received under one delivery document.

    Example of FIFO valuation

    Let's look at an example of using the FIFO method in practice. The figure below shows the initial data on the receipt and use of fabric inventories. During the month of March, 270 meters of fabric were consumed; it is necessary to determine the fabric reserves for April.

    FIFO method. Calculation example

    When calculating using the FIFO method, it is necessary to use data sequentially, starting with the balances for the previous month. The total amount of fabric received for March was 13,400 rubles. 270 includes the balance for the previous month - 100 meters, 120 meters for the first receipt and 50 meters for the second receipt. The cost of scrapped material is calculated as follows:

    100 x 35 rub. + 120 x 40 rub. + 50 x 45 rub. = 10,550 rub.

    The estimated cost of one meter of fabric using the FIFO method is:

    10,550 / 270 = 39.07 rubles.

    Calculation of the value of the balance at the end of the month: (3500+ 13400) – 10550 = 6350 rubles.

    Valuation of balances using the FIFO method

    It should be remembered that the first thing next month will be the materials from the second batch of fabric. At the end of March, the balance will include materials from the second and third batches of fabric, in quantities of 30 and 100 meters, respectively.

    Click and read in detail about the cost of production and how to account for it in an organization:

    What is cost? Classification of production costs. Accounting for inventories. Accounting for accounts payable for inventories. Score 66, 67.

    ★ Best-selling book “Accounting from scratch” for dummies (understand how to do accounting in 72 hours) > 8,000 books purchased
    Rating
    ( 2 ratings, average 4 out of 5 )
    Did you like the article? Share with friends:
    Business guide