Why does instruction/data alignment exist?

无人久伴 提交于 2019-12-02 19:16:58

问题


I frequently see information about architecturally instructions and data must be aligned to word, half-word, etc. boundaries. While it is not difficult to follow these rules, I am just wondering if someone can tell why (generally) this requirement exists?

EDIT: basically found my answer here: why is data structure alignment important for performance?


回答1:


this is because of high efficient data bus design issue. With aligned memoey address, the data can fit in the data bus efficiently.

For a 32 bit word load, if it is aligned, all the 32bit data bus which connect the CPU and DRAM MEMORY.Otherwise, the computer have to use the lower part of the data bus once, and then load again using the higher part of the data bus.

What is more, the current cache architecture design also take advantage of align constraint



来源:https://stackoverflow.com/questions/13400694/why-does-instruction-data-alignment-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!