Question

In: Electrical Engineering

Verilog code to make 8bit bcd to 8bit binary please with testbench

Verilog code to make 8bit bcd to 8bit binary please

with testbench

Solutions

Expert Solution

Code :

Output

Test_bench:

Output :

Main_code :

`timescale 1ns / 1ps

module bcd_binary(in_bdc,out_binary);

input [7:0] in_bdc; //declaring input and output
output [7:0]out_binary;
wire [3:0]a,b;

assign a = in_bdc[3:0]; //assigning lsb four bits to a
assign b = in_bdc[7:4]; //msb four bits to b

assign out_binary = b*10+a; //converting that into binary


endmodule

Test_bench :

`timescale 1ns / 1ps

module test_bcd();
reg [7:0] in_bdc;
wire [7:0] out_binary;
reg [3:0]a,b;

bcd_binary x(in_bdc,out_binary); //instantiation our main code

initial
$monitor("input = %b | output = %b ",in_bdc,out_binary); //displaying results

initial
begin
#20 in_bdc = 8'b00011000; //giving some random inputs
#20 in_bdc = 8'b00100110;
#20 in_bdc = 8'b00110001;
#50 $finish; //finishing
end
endmodule


Related Solutions

Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible if possible, post Pic of the waveform simulation!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible waveform simulation answer would be nice too!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible!
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it,...
Please Create the Verilog/Vivado Code For: An LFSR Pseudonumber generator, and the testbench for test it, please comment and explain the answer as much as possible,(Make your own code, even it is more simple, but do not copy from others sources on the internet) if possible, post Pic of the waveform simulation!
Write down the VERILOG code for an XOR gate and the testbench code to test it
Write down the VERILOG code for an XOR gate and the testbench code to test it
Design an 8-bit adder. Show Verilog code and testbench.
Design an 8-bit adder. Show Verilog code and testbench.
a) Design a16-bit MIPS Processor in a simplest form in Verilog code with testbench. Please mention...
a) Design a16-bit MIPS Processor in a simplest form in Verilog code with testbench. Please mention the comments where applicable. b) mention the steps how your design works.
Verilog code for Traffic light controller. Need a block diagram, Verilog codes used with testbench, and...
Verilog code for Traffic light controller. Need a block diagram, Verilog codes used with testbench, and the waveforms screen-prints.
Please write down in Verilog code with testbench: Audio Tone Generator like Ambulance siren or Police...
Please write down in Verilog code with testbench: Audio Tone Generator like Ambulance siren or Police siren.
Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado...
Design and write a verilog code and testbench for a 16-bit RISC MIPS Processor on vivado and show waveform.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT