How can I write a simple pseudo assembler?

I need to write a series of test benches for a simple processor model written in VHDL. I need a piece of code that converts an instruction into assembly code (MIPS) into a binary string. I don't need anything clean or elegant. The only goal is to speed up testing. I thought to write emacs or vim script with abbreviations or something like that. What are you offering?

+3
source share
2 answers

If you say vim and emacs, you can try a simple bash script. You can easily read line-by-line in a file, and line parsing and case arguments are quite effective (especially if you use $ IFS wisely). Otherwise, it sounds like work for the scripting language of your choice, be it bash, perl, ruby, python, vim macros or something else.

+1
source

You can try the old Cu M- | send the mips string in emacs to an external program and replace the string with the results. Thus, you can use any method that you want to write to a real program.

, MIPS , , , script ( , , , ), , - MIPS.

0

Source: https://habr.com/ru/post/1778500/


All Articles