# Move function for a memory model based class

**URL:** <https://verificationacademy.com/forums/t/move-function-for-a-memory-model-based-class/35147>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, Move-Memory-Class\
**Created:** [October 7, 2018, 10:49am UTC](https://verificationacademy.com/forums/t/move-function-for-a-memory-model-based-class/35147 "2018-10-07T10:49:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [October 24, 2018, 4:20am UTC](https://verificationacademy.com/forums/t/move-function-for-a-memory-model-based-class/35147/5 "2018-10-24T04:20:07Z")

</div>

_In reply to [Mark Curry](https://verificationacademy.com/forums/t/move-function-for-a-memory-model-based-class/35147/4):_

This is simplest way. But be careful when memory wrap around.

Should change:

```verilog

for( int i = 0; i < size; i++ )
  mem[(dest_address + i) % DEPTH] = mem[(source_address + i) % DEPTH];

```

---

_[View the full topic](https://verificationacademy.com/forums/t/move-function-for-a-memory-model-based-class/35147)._
