Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~9K People Reached

36 Posted Topics

Member Avatar for 7h3.doctorat3

Looks like you're on the right track, just keep in mind that if you have to account for all 999 cases of 3 digit numbers then it would be advantageous for you to look for word aliasing. For instance, eleven occurs 11 times within that range. hundred occurs 900 times …

Member Avatar for prvnkmr449
0
776
Member Avatar for dansnyderECE

0 down vote favorite I'm trying to figure out how exactly to use stat() to capture information about a file. What I need is to be able to print several fields of information about a file. So.. [CODE] #include <iostream> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> using namespace std; int …

Member Avatar for dansnyderECE
0
517
Member Avatar for dansnyderECE

I need to convert an ASCII string like... "hello2" into it's decimal and or hexadecimal representation (a numeric form, the specific kind is irrelevant). So, "hello" would be : 68 65 6c 6c 6f 32 in HEX. How do I do this in C++ without just using a giant if …

Member Avatar for vijayan121
0
220
Member Avatar for dansnyderECE

I can't figure out how to get rid of this race condition I'm getting in my synthesizable verilog code. Basically, I'm generating an input value for a module, and at positive edge of my clock I capture that value at my module. The problem is that I want the value …

Member Avatar for teja_dt
0
97
Member Avatar for dansnyderECE

I'm trying to compile an executable (ELF file) that does not use a dynamic loader. I built a cross compiler that compiles mips from linux to be used on a simulator I made. I asserted the flag -static-libgcc on compilation of my hello.cpp file (hello world program). Apparently this is …

Member Avatar for vijayan121
0
2K
Member Avatar for dansnyderECE

I can't seem to disable dynamic linking. How do I do this? I've tried the following: [CODE]babbage-dasnyder 19% mips-unknown-linux-gnu-g++ -static -static-libgcc hello.cpp babbage-dasnyder 20% file hello hello: ELF 32-bit MSB MIPS-I executable, MIPS, version 1 (SYSV), for GNU/Linux 2.4.18, dynamically linked (uses shared libs), not stripped[/CODE] But as you can …

Member Avatar for mike_2000_17
0
355
Member Avatar for dansnyderECE

I'm a bit confused about the executable offset in ELF files. Do you know what the difference between an address and an offset is in this context? It seems obvious but if you look at the 2 sections I bolded, sometimes the offset is something like : 00400164 000164 which …

Member Avatar for dansnyderECE
0
193
Member Avatar for dansnyderECE

I chopped down my make file so I can compile a C++ program with very few, but some flags set to see if I can determine if they are working. The following is my make file section on C++ flags: [CODE]# Common compiler flags CFLAGS = -mips1 -Wa,-non_shared \ -mno-abicalls …

Member Avatar for vijayan121
0
556
Member Avatar for dansnyderECE

So, my main goal is to modify a MIPS simulator to display the contents of the register file during run time. I searched around in the simulator's cpp files and this is what I've determined: There is a file called "ThreadContext.h" which contains the lines: [CODE] typedef long ValueGPR; ... …

Member Avatar for Excizted
0
183
Member Avatar for dansnyderECE

My daily text editing question.... I'm traversing a text file line by line adjusting the text so that the file eventually will match the syntax required to be run on a MIPS simulator (MARS). My issue is that whenever I see a line with the string "blezl" in it, I …

Member Avatar for Aranarth
0
98
Member Avatar for dansnyderECE

I'm trying to replace some MIPS II instructions using MIPS I - namely the branch likely instructions. I'm having difficulty deciding how to do this. Assume that the branch delay slot is implemented. First off, a branch likely is an instruction that when taken, executes the delay slot instruction whereas …

Member Avatar for dansnyderECE
0
125
Member Avatar for dansnyderECE

I'm using a cross-compiler that generates MIPS binaries from c++ (mipseb-linux-g++). What I want to do is tell the compiler to use a specific ISA (namely MIPS I). From what I can tell this is a machine option that should be easily configurable. I've tried changing the option in my …

0
124
Member Avatar for dansnyderECE

I have several strings in a text file and I want to search each string for a word starting with "<" and ending with ">". I then want to replace everything from < to > with a new string. So here's a couple lines I want to convert: [CODE] 400110: …

Member Avatar for NathanOliver
0
125
Member Avatar for dansnyderECE

I don't understand what the issue is here. Here is the line in question: [CODE]beqz $t0, main[/CODE] and I get a syntax error here. Also, why is it that I cannot use the $at register? Also, I get a syntax error fr this line: [CODE]move $a0,$v0[/CODE] Whats wrong here?

0
82
Member Avatar for dansnyderECE

I'm trying to convert a disassembled Hex Dump to a SPIM friendly assembly file. This requires that I take lines like: [CODE] 004000f8 <_init>: 4000f8: 27bdffe8 addiu sp,sp,-24 4000fc: afbf0010 sw ra,16(sp) 400100: 0c100064 jal 400190 <call_gmon_start> 400104: 00000000 nop 400108: 0c100094 jal 400250 <frame_dummy> ... [/CODE] and make them: …

Member Avatar for nbaztec
0
149
Member Avatar for dansnyderECE

Is there a good way to determine the end of a a line in a text file? I need to find of end of a line in text because all text lines are of different length. I also have to store each word (separated by spaces) into a vector. [CODE] …

Member Avatar for nbaztec
0
247
Member Avatar for dansnyderECE

I'm searching a text document and replacing substrings with other substrings. So for instance: "ra,16([B]sp[/B])" with "ra,16([B]$sp[/B])" The issue I'm having is that say I have the following string: "sp,sp,24" How do I re-iteratively replace "sp" with "$sp" twice without getting: "$$sp,$sp,24" This is my code: [CODE] ... if ( …

Member Avatar for Taywin
0
104
Member Avatar for dansnyderECE

I'm trying to convert part of a string. Say I have a bunch of strings and I want to search through all of them, and whenever one of them have the string "34" contained within, I want to convert that part of the string to "XX". Imagine the following: [CODE] …

Member Avatar for dansnyderECE
0
151
Member Avatar for dansnyderECE

So, I've learned my lesson in the past. I'm not experianced enough to design a program from start to finish in an elegant way. I'm not looking for code in any way, just some code flow suggestions if anyone has any. This is what I'm trying to do: -Do a …

Member Avatar for Radical Edward
0
99
Member Avatar for dansnyderECE

I'm trying to compile an assembly file (.asm or .s) from a c++ file to be used in SPIM. SPIM requires that the file be in MIPS32ABI and for MIPS I ISA. My g++ compiler is not working well and I was wondering if there were any compilers out there …

0
92
Member Avatar for dansnyderECE

I'm attempting to manually load the hexdump of an elf file that I compiled using g++ into a processor simulation I designed. There are 30 sections to a standard elf file and I am loading all 30 segments with their proper memory location offset taken into account. I then start …

Member Avatar for dansnyderECE
0
138
Member Avatar for dansnyderECE

I'm trying to compile a c# file and generate an asm or s file to be disassembled and run in PSIM. Whenever I try to do this I get errors. I am attempting to compile to mipsI-linux. I think I've determined that my cross compiler that was given to me …

0
68
Member Avatar for dansnyderECE

I'm attempting to test an assembly file compiled from my c++ program and I keep getting errors. My program is a simple "hello world" but no matter what I try and what variation of assembly files I try I can't get a solid run on anything bu the exception.s that …

Member Avatar for dansnyderECE
0
945
Member Avatar for dansnyderECE

I'm trying to use .open() but I'm having an issue with my arguments to this function. Here's my code: [CODE] vector<string> FDT_filename; ifstream is; is.open (FDT_filename[0], ios::binary );[/CODE] Which results in the following error: [CODE] ../sim_main.cpp:297: error: no matching function for call to ‘std::basic_ofstream<char, std::char_traits<char> >::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const …

Member Avatar for dansnyderECE
0
184
Member Avatar for dansnyderECE

I think this is an easy question but I don't know the answer to it. How does one link the value of an argument to a function and the functions parameters? For instance: [CODE]int a; int b; void fn(int &c, int &d) { c++; d++; } int main() { fn(a,b); …

Member Avatar for aman rathi
0
180
Member Avatar for dansnyderECE

I want to represent 2^32 elements in a vector. In reality, I allocate about 500,000 elements and then everything else is there to be used by my program (for storage of data). So I have to have say.. elements: [0-999999] = 0 [100000-599999] = info [600000 +] = 0 <-really …

Member Avatar for dansnyderECE
0
164
Member Avatar for dansnyderECE

I'm trying to copy a string into a character array to be used in .write(). Here is a bit of my code to show you what I mean: [CODE] //input_buffer is a string that is determined during runtime int length = 5; char * buffer = new char [input_buffer.size()]; buffer …

Member Avatar for dansnyderECE
0
102
Member Avatar for dansnyderECE

Im trying to open a file, and then read a user defined number of characters from said file. I want to do this using scanf but I can't quite figure out how it works. I can get scanf to work just fine but I can't determine how to specify the …

Member Avatar for dansnyderECE
0
96
Member Avatar for dansnyderECE

I have a vector full of decimal values and I want to convert each element of the vector to ASCII represented strings (or char arrays). How do I do this? Each element of the array is 8 hex bits long and has been converted to it's decimal representation. So... HEX(41424344) …

Member Avatar for daviddoria
0
207
Member Avatar for dansnyderECE

Is there a good way to map vectors? Here's an example of what I mean: vec0 = [0,0,0,0,0,0,0,0,0,0,0] vec1 = [1,4,2,7,3,2] vec2 = [0,0,0,0,0,0,0,0,0] vec2 = [7,2,7,9,9,6,1,0,4] vec4 = [0,0,0,0,0,0] mainvec = [0,0,0,0,0,0,0,0,0,0,0,1,4,2,7,3,2,0,0,0,0,0,0,0,0,0,7,2,7,9,9,6,1,0,4,0,0,0,0,0,0] Lets say mainvec doesn't exist (I'm just showing it to you so you can see the general …

Member Avatar for daviddoria
0
103
Member Avatar for dansnyderECE

I'm having difficulty using reinterpret_cast. Before I show you my code I'll let you know what I'm trying to do. I'm trying to get a filename from a vector full of data being used by a MIPS I processor I designed. Basically what I do is compile a binary from …

Member Avatar for gashtio
0
179
Member Avatar for dansnyderECE

I'm trying to figure out how to get a string from an array starting at some given position. Say we have an array that's arbitrarily long and my string starts at location 1000. If I wanted to get a string from a file I would simply use something like getc …

Member Avatar for dansnyderECE
0
128
Member Avatar for dansnyderECE

I'm trying to fill a string with the name of a file stored in a "fake memory" vector. Assuming I have a start pointer that directs me to the beginning of the string in my memory and I know the string completes with a NULL, how do I do this? …

Member Avatar for Murtan
0
71
Member Avatar for dansnyderECE

My process involves: - Run Make on a c++ file and generate a binary file - Run readelf on binary file generated and dump contents in HEX form into NEW_File *- Import data from generated file into c++ file vector as 8 bit hex words *- other VLSI related sections …

Member Avatar for dansnyderECE
0
118
Member Avatar for dansnyderECE

Note that I posted this thread earlier, I'm reposting because the issue has evolved some and I have a clearer idea of what the problem is. I'm trying to resolve a segmentation fault that occurs in the traversal of a string array. My code is doing the following: - open …

Member Avatar for dansnyderECE
0
383
Member Avatar for dansnyderECE

I'm having an annoying issue with this code. I get a segmentation fault because of the loop wrapped in comments. Any ideas? This is the goal of this program: First I wrote a simple c++ program and compiled a binary file for it. I then use readelf to dump the …

Member Avatar for dansnyderECE
0
184

The End.