nios

What does the assembly instruction trap do?

拟墨画扇 提交于 2019-12-23 01:54:34
问题 "RTFM" A program typically issues a software trap when the program requires servicing by the operating system. The general exception handler for the operating system determines the reason for the trap and responds appropriately. Is the assembly instruction trap alike the instruction TRAP in BASIC? The answer seems to be yes. Can you accept or reject my conclusion? Code for "no interruption" is according to my instructions: noint: PUSH r8 movia r8,0x003b683a # machine code for TRAP ldw et,-4

What is the “relationship” between addi and subi?

北城余情 提交于 2019-12-18 09:25:58
问题 I'm supposed to answer this question. After some research it says that add and sub have the same opcode and differ only in the functional field. Is this the answer or something else? Update It's available in the Nios II CPU manual: subi subtract immediate Operation: rB ← rA – σ (IMMED) Assembler Syntax: subi rB, rA, IMMED Example: subi r8, r8, 4 Description: Sign-extends the immediate value IMMED to 32 bits, subtracts it from the value of rA and then stores the result in rB. Usage: The

What is the “relationship” between addi and subi?

馋奶兔 提交于 2019-12-18 09:25:46
问题 I'm supposed to answer this question. After some research it says that add and sub have the same opcode and differ only in the functional field. Is this the answer or something else? Update It's available in the Nios II CPU manual: subi subtract immediate Operation: rB ← rA – σ (IMMED) Assembler Syntax: subi rB, rA, IMMED Example: subi r8, r8, 4 Description: Sign-extends the immediate value IMMED to 32 bits, subtracts it from the value of rA and then stores the result in rB. Usage: The

Serial port timeout- 10 seconds, but getting less samples than expected/desired

别来无恙 提交于 2019-12-13 02:34:53
问题 I have the following error while trying to access serial port data sent from Nios II UART: The specified amount of data was not returned within the Timeout period or A timeout occurred before the Terminator was reached. The above error occurs when I set the timeout to be smaller than 10 seconds, say 2 seconds, or 6 or 8 etc. set(s,'BaudRate',115200,'timeout',10); %timeout is in seconds. If I set the timeout to be as '10' or larger, I did not get the timeout error, however, with this timeout,

How to develop this algorithm?

血红的双手。 提交于 2019-12-11 19:44:30
问题 pollkey() should be called every millisecond and tick(&timeloc) should be called every second and I don't have a thread library. The obvious way would be to do it with threads but now it seems that I need advice how to perform both the updates. The code I'm trying is int main() { while (TRUE) { pollkey(); puttime(&timeloc); delay(1); IOWR_ALTERA_AVALON_PIO_DATA(DE2_PIO_REDLED18_BASE, timeloc); if (RUN == 1) { tick(&timeloc); puthex(timeloc); } } return 0; } But I don't think that the above is

Practical way to parse a float with newlib without locale support

随声附和 提交于 2019-12-11 16:48:23
问题 I'm experimenting with NIOS II soft core, trying to minimize the footprint of my embedded app. One of the biggest gains I get comes from using the small C library (p 206): The full newlib library functionality is often unnecessary for embedded systems, and undesirably large for systems needing a minimal RAM footprint. Altera provides a reduced-functionality reduced-size "Small C" version of newlib which allows smaller RAM footprints to be achieved. One of the features stripped down from small

Why is my serial communication not working?

流过昼夜 提交于 2019-12-11 14:27:26
问题 I looked in the manual (page 177) for the DE2 and as far as I understand it should be possible to do serial communication for instance via putty and a usb-to-serial cable to the board, so I take the program from the manual: /* A simple program that recognizes the characters 't' and 'v' */ #include <stdio.h> #include <string.h> int main () { char* msg = "Detected the character 't'.\n"; FILE* fp; char prompt = 0; fp = fopen ("/dev/uart1", "r+"); //Open file for reading and writing if (fp) {

Difference between load word and move?

扶醉桌前 提交于 2019-12-08 16:39:08
问题 What is the difference between ldw r8,0(r4) and mov r8, r4 Load word says "copy from memory" but when load word copies from r4, it is copying from register and not from memory right? 回答1: The lw instruction (I assume that's what you meant since ldw isn't a standard MIPS instruction, though all the loads will be similar in the context of this answer) loads a word from the memory address specified by 0 + r4 , while move 1 simply transfers the value of r4 into r8 . For example, let's say r4 is

What does the assembly instruction trap do?

心不动则不痛 提交于 2019-12-07 15:38:28
" RTFM " A program typically issues a software trap when the program requires servicing by the operating system. The general exception handler for the operating system determines the reason for the trap and responds appropriately. Is the assembly instruction trap alike the instruction TRAP in BASIC? The answer seems to be yes. Can you accept or reject my conclusion? Code for "no interruption" is according to my instructions: noint: PUSH r8 movia r8,0x003b683a # machine code for TRAP ldw et,-4(ea) # read instr closest to return cmpeq et,et,r8 # compare POP r8 bne et,r0,TrapHandler # if equal,

How to convert from 4-bit hexadecimal to 7-bit ASCII?

别说谁变了你拦得住时间么 提交于 2019-12-05 01:16:09
问题 The assigment is to learn assembly programming by writing a subroutine that can convert between 4-bit hexadecimal and 7-bit ASCII. At first I had no idea but after some research I could make and effort and draw a flowchart and make a program but it is not entirely correct so I'm asking for your guidance to help me solve this. The actual assignment text is this: HA 3.1. Draw a flow-chart for a subroutine to convert a 4-bit hexadecimal value to the corresponding 7-bit ASCII-code. See the full