What happens in a supermarket when a barcode is read at the checkout?

本文详细介绍了超市中条形码扫描的工作原理及其在商品库存管理中的应用。当条形码被扫描时,其对应的数字会在库存数据库中进行搜索,并获取商品描述及价格等信息。同时,该系统能自动更新库存数量并触发补货流程。

My blog https://blog.youkuaiyun.com/zhangxingping/article/details/116346886 gives a detailed description of how a barcode scanner reads a barcode.

This blog gives you a general description of what happens in a supermarket when a barcode is read at the checkout.

  1. A supermarket has a database server which is used stores the information about the goods they are selling, including the descriptions, prices, numbers of stock items.
  2. The barcode uniquely identifies each item.
  3. When a barcode is scanned, its equivalent number is searched for in the stock database.
  4. The stock item is found by using the barcode number and the description and price are send back to the checkout and they are displayed on the monitor.
  5. The number of stock item is reduced by one each time the barcode is read.
  6. The new number is checked against the re-order level. If it is less than or equal to this value and the item is not re-ordered, more stock items are re-ordered automatically.
  7. An item is marked reordered to prevent the duplication of reorder each time a reorder is make.

The advantages of using barcodes:

To the management:

  • easier and faster to find the price of each item.
  • easier to update sales information
  • allows for automatic stock control.

To the customer:

  • quicker checkout queue. (Entering the numbers of goods that you purchase manually is slow and error-prone)
  • quicker and correct charge. (The computer can do the calculation much faster and it does not make mistakes.)
  • under the control of computer, an itemized bill can be given to the customer.

 

在ARM7处理器中,当执行寄存器加载(register load)或寄存器存储(register store)指令时,指令流水线的情况如下所示: 1. 取指令(IF)阶段:在这个阶段,处理器从内存中获取下一条待执行的指令。对于寄存器加载或存储指令,处理器将读取并解码该指令。同时,程序计数器(PC)会自增,以便在下一个时钟周期读取下一条指令。 2. 指令译码(ID)阶段:在这个阶段,处理器识别并解码指令,并确定指令的操作类型。对于寄存器加载或存储指令,处理器会解析出要加载或存储的寄存器编号,并在寄存器文件中获取相应的数据。 3. 执行(Execute)阶段:在这个阶段,如果是寄存器加载指令,处理器会从寄存器文件中读取相应的数据,并将其传递给下一个阶段进行操作。如果是寄存器存储指令,处理器会将要存储的数据传递给下一个阶段。 4. 存储(Memory Access)阶段:对于寄存器加载指令,这个阶段不涉及任何操作。对于寄存器存储指令,处理器会将要存储的数据写入到内存中的指定地址。 5. 写回(Write Back)阶段:对于寄存器加载指令,处理器将从上一个阶段接收到的数据写回到寄存器文件中的目标寄存器。对于寄存器存储指令,这个阶段不涉及任何操作。 下图是一个简化的ARM7指令流水线示意图,说明了寄存器加载和存储指令在指令流水线的各个阶段中的处理情况: ``` |-----------------|-----------------|-----------------|-----------------|-----------------| Cycle: | IF | ID | Execute | Memory Access | Write Back | |-----------------|-----------------|-----------------|-----------------|-----------------| | Fetch Instr | Decode Instr | Load Regs | | | |-----------------|-----------------|-----------------|-----------------|-----------------| | | Read Regs | Operate | | | |-----------------|-----------------|-----------------|-----------------|-----------------| | | | | Access Memory | | |-----------------|-----------------|-----------------|-----------------|-----------------| | | | | | Write Regs | |-----------------|-----------------|-----------------|-----------------|-----------------| ``` 上述图表中的每个阶段都代表一个时钟周期。在每个时钟周期内,不同的指令在指令流水线中的不同阶段并行执行,从而提高了指令的执行效率和吞吐量。 请注意,实际的ARM7处理器可能具有更多的流水线阶段和更复杂的流水线结构,这里仅提供了一个简化的示意图来说明寄存器加载和存储指令在指令流水线中的处理情况。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值