如何在mips汇编编程中计算时钟周期? [英] How do I calculate clock cycles on mips assembly programming?
问题描述
我到处搜寻了,我收集了管道或其他东西.我检查了其他程序,似乎有一个单周期&多周期:单周期和多周期MIPS的时钟周期
I've searched up everywhere, and ive gathered pipelines or something. I've checked other programs and it seems like theres a single-cycle & multicycle: Clock cycles of Single-cycle and multi-cycle MIPS
我该如何区分哪个周期的差异.
How do I tell the difference for what cycle.
例如,这将是几个时钟周期:
like for example, how many clock cycles would this be:
li $a0, 0 # $a0 = 0
li $t0, 10 # Initialize loop counter to 10
Loop:
add $a0, $a0, $t0
addi $t0, $t0, -1 # Decrement loop counter
bgt $t0, $zero, Loop # If ($t0 > 0) Branch to loop
我的教授给我做了一个作业:假设在内存中加载和存储值要花费100个周期,再加上指令的花费 本身."
My professor gave me this for an assignment: "Assume that loading and storing values in memory cost 100 cycles plus the cost of the instruction itself."
根据我的读物,加载是5个周期,所以为什么我的教授说它是100个周期.我可以把它设为我想要的任何数字吗?我很困惑
From what I've read, loading is 5 cycles, so why is my professor saying its 100 cycles. Can I make it whatever number I want? I'm very confused.
推荐答案
这个问题没有道理.
在大多数教育性MIPS实现中使用的标准多周期RISC管道从根本上基于以下要求:程序和数据存储器都可以在单个周期中同时访问.要假设在内存中加载和存储值要花费100个周期",则需要一个完全不同的体系结构.
The standard multi-cycle RISC pipeline, as used in most educational MIPS implementations, is fundamentally based around the requirement that program and data memory can both be accessed simultaneously in a single cycle. To "assume that loading and storing values in memory cost 100 cycles" would require a completely different architecture.
这篇关于如何在mips汇编编程中计算时钟周期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!