contributed by david965154
The code above is trying to make output signal led
change its signal after CNT_MAX
cycles, here is its process
First time call:new a Hello
class and set every val
, then excute
CNT_MAX-n times call:excute
CNT_MAX times call:
In this time, the blkReg
was set as ~blkReg
and io.led
was set as blkReg
. Therefore, the io.led
will maintain the signal as ~blkReg
for next CNT_MAX-1
times call.
Here is my logic circuit:
To implement:
OS:macos 14
terminal
Problem:
OK, you're using the most recent version that I built…which was three years ago.
As I said, I don't have a Mac, so unfortunately, I can't build a binary that will work for you. Setting up a build environment on Mac using GTK-OSX is a fairly involved process unless it's been simplified. Another user might be able to help you.
sbt test
cannot be operated and here is its error message:java.lang.IllegalArgumentException: requirement failed: /Users/chenjinzhun/ca2023-lab3/verilog/sb.asmbin.txt is not a relative path
why:
If the error was occur in my code, the error message should be the value not equal to expect value. But the message look like the expect path is relative path but not absolute path. And I pretty sure that before I do the operation mention above, the error message is not exist.
First:
Modify the C code and put it into csrc
To compatible with the sbt test, I modify the printf
to store word in specify memory address, then the sbt test
can verify the value and expect value if equal.
modify the .S code to and put it into csrc
Second:
Modify the Makefile
To compile the my C code and .S to .o
and .asmbin
, I need to add mycode.asmbin under the BINS
in this document. Then type make
(produce .o
and .asmbin
) and make update
(produce .asmbin
under the directory src/main/resources/
)
Last:
Modify the CPUTest
To follow the rule as previous example code, I new these code.
What's important
the part:
In my opinion, this part is need to prevent previous part code from executing in the same time.
The io_instruction_address
is depends on io_jump_flag_id
:
0
:pc=pc+4(address=address+4)
1
:pc=jump address
See the instruction type io_instruction
, the different between its signal can correspond to io_regs_reg1_read_address
, io_regs_reg2_read_address
, io_memory_read_enable
, io_memory_write_enable
and some other signal.
L type
: io_memory_read_enable
= 1
S type
: io_memory_write_enable
= 1
In this TestOnly
, the instruction add
and beq
will be execute. The front one in waveform is add
, the piece of tail part is beq
, you can see the io_if_jump_flag
is activate.
In my priortyencoder
, the io_mem_debug_read_address
will store the value correspond to io_mem_debug_read_data
and to check the answer if equal to the expect value.
will get
then, type