LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I implement a stack in LabVIEW?

Solved!
Go to solution

As a pet project, I'd like to emulate an LC3 microcontroller in LabVIEW. The memory map is like so:

 

It's got a 16bit word size and is 16bit addressable. Is this possible?

0 Kudos
Message 1 of 4
(5,053 Views)
Solution
Accepted by ijustlovemath
Of course it is - use a large array of U16. Array indices in LabVIEW are 32 bits, so you shouldn't have a problem with 16-bit addresses treated as an array index.
0 Kudos
Message 2 of 4
(5,020 Views)

Also, if you search here, you can find emulators for C64 and the Apple II. I'm guessing both are considerably more complex than the microcontroller architecture, but they might be interesting for you.

 

Also, an array is not a stack. It can be used to represent the memory space for the uC, but you will still need to implement the stack logic. If you simply asked about a stack, I would say use a queue and enqueue at the front, but in your case it probably is better to use the array directly and simply maintain a program counter which remembers where you are on the stack.

 

Incidentally, how good is your LV knowledge? I never tried this, but emulating a processor architecture seems to me be a relatively advanced use case. True, it's more advanced in the knowledge of how to do it rather than in the knowledge of the language itself, but if you're asking this type of question, maybe it's more than you can chew? I haven't looked at your post history, so maybe this question isn't indicative, or maybe this is exactly the type of thing you need. If you do complete it and don't mind sharing, I'm sure there are multiple people who wouldn't mind have a look at it.


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(4,806 Views)

Ha, despite the nooby question, I am pretty good with labview. I'm doing this both to push my labview knowledge and reenforce my knowledge on some stuff from my digital design courses. The reason I asked initially is because my search for this on google yielded queues, but you can't arbitrarily insert into queues, so (as you said), my program counter won't work. If you're unfamiliar with LC3, it's pretty simple, and explained completely in two pdfs:

 

http://users.ece.utexas.edu/~patt/07s.360N/handouts/360n.appC.pdf

https://www.google.com/search?q=patelpattappa.pdf&ie=utf-8&oe=utf-8#q=patt+patel+appendix+a

 

It's a teaching machine (so I don't even think it's Turing Complete), and there are already assemblers and simulators that exist for it, but again, just a pet project of mine.

0 Kudos
Message 4 of 4
(4,716 Views)