



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




You are required to write codes for
This converter receives 8bit mini floating point number which defined above and produces 8bit integer number. Assume only positive floating point number with exponent value which is greater than or equal to 15 for the simplicity of the code. Mini_Float_Adder This adder receives two 8 bit mini floating point number which defined above and produces summation of the two 8 bit mini floating point number with the mini floating point format. //Template //Copy this template and name it "hw 2 .v". // Problem 0: // Write down your name and your account here // Your Name : ####### // Your Account: ####### // // Problem 1 : Convert the following numbers. (15pts) // 1 .1) Decimal 7 to 8-bit Binary: (2pts) // Write your answer here; // 1 .2) Decimal - 7 to 8-bit Binary (2pts) // Write your answer here: // 1 .3) Decimal 7 .875 to Binary (as many bits as needed) (3pts) // Write your answer here: // 1 .4) Decimal - 7 .875 to IEEE 754 Single Precision (8pts) // (Show in hexadecimal): // Write your answer here: //Problem 2. // 2.1 Convert integer number, 3 to the mini 8 bit floating point number(5pts).
//Answer: //(hint: think about the example above) //2.2 fill the code to complete the module Mini_Integer2Float_Converter(20pts) module Mini_Integer2Float_Converter(Out_Float,In_Int); input [7:0] In_Int; output [7:0] Out_Float; always begin //Write down your code here // There will be no penalty for a little bit longer code // as long as your code produces right answer // You may declare more variables and use them. //You should put this code: $display("print in_Int_value = %b, print_out_float_value = %b\n",In_Int,Out_Float); //You also have to think about “always @...” //Hint “ always @In_Int” or you may write your code differently. end endmodule //Problem 3. // 3.1 Convert the mini 8bit floating point number number, 01000111 to // 8 bit binary number (5pts). //Answer: //(hint: think about the example above) //3.2 fill the code to complete the module Mini_Float2Integer_Converter(20pts) module Mini_Float2Integer_Converter(Out_Int,In_Float); input [7:0] In_Float; output [7:0] Out_Int; always begin //Write down your code here // There will be no penalty for a little bit longer code
/// Do not modify test bench module test(); reg [ 7 :0] In_Int; wire[7:0] Out_Int,Out_Float,Out_Float_Add ; integer i; Mini_Integer2Float_Converter MIF(Out_Float,In_Int); Mini_Float2Integer_Converter MFI(Out_Int,Out_Float); Mini_Float_Adder MFA(Out_Float_Add,Out_Float,Out_Float); initial begin for(i=0; i<= 15 ; i=i+1) begin In_Int = i[ 7 :0]; #100; $display("####int = %b\n",In_Int); end $display("Tests completed."); $finish; end endmodule