picoblaze Celsius to fahrenheit conversion in assembly

190 Views Asked by At

I want to perform on picoblaze (FPGA) Celsius to fahrenheit conversion in assembly using the following conversion formula Fahrenheit = (Celsius * 9 / 5) + 32. But I am not able even to make simply multiplication of two number in assembly language. Can someone help me ? I have seen through google how to perform this conversion in assembly but picoblaze has it's own specific syntax.

2

There are 2 best solutions below

0
Holminge On

I can recommend you to have a look at Instant SoC instead. You only need to write C++ and since the hardware is optimized to the code it will be almost as small as Picoblaze. I use Instant SoC instead of both Microblaze and Picoblaze now.

0
FlatAssembler On
;Let's say Celsius is on input 0
;and you are supposed to output
;Fahrenheit on output 0.

address 0
input s0, 0
load s1, 0
load s2, 9
multiplication_by_9:
add s1, s0
sub s2, 1
jump nz, multiplication_by_9
load s2, 0
division_by_5:
add s2, 1
sub s1, 5
jump nc, division_by_5
add s2, 32'd
output s2, 0
jump 0

You can try it in the PicoBlaze Simulator in JavaScript I made.

EDIT: I've started a new thread asking how to improve that program to work with a wider range of inputs.