Go to the documentation of this file.00001
00002 void readmemh(std::string fname, ULLONG* mem, ULLONG astart, ULLONG afinish)
00003 {
00004 std::ifstream ifs (fname.c_str() , std::ifstream::in);
00005 ULLONG val;
00006 for (ULLONG i = astart; i <= afinish; i++)
00007 {
00008 if (ifs >> std::hex >> val)
00009 {
00010 mem[i] = val;
00011 }
00012 else
00013 {
00014 std::cerr << "Cannot read file: " << fname << ", addr: " << i << std::endl;
00015 ifs.close();
00016 return;
00017 }
00018 }
00019 ifs.close();
00020
00021 }