Question

Write a VHDL code to implement the circuit function described below.

Student Id : 8123405

Last 4 digits : 3405

6. Write a VHDL code to implement the circuit function described below The circuit is to display the last four digits of your

0 0
Add a comment Improve this question Transcribed image text
Answer #1

---VHDL Code

--We will design a Moore State Machine, with four states
--Each state will output one digit on seven segment display
--last four digit is 3405
--seven segment display shown is of common anode type

library ieee;
use ieee.std_logic_1164.all;

entity circuit_function is

   port (   DIR   : in std_logic;
       CLK   : in std_logic;
       RST   : in std_logic;
       A, B, C, D, E, F, G : out std_logic
   );
end circuit_function;

architecture arch of circuit_function is

type state is (S0, S1, S2, S3);
signal present_state, next_state : state;

signal seg : std_logic_vector(6 downto 0); --represents gfedcba segments

begin

process (CLK)
begin

   if (RST = '1') then
       present_state <= S0;

   else
       if falling_edge (CLK) then
           present_state <= next_state;
       end if;
   end if;

end process;

process (present_state)
begin
   case (present_state) is
       when S0 =>    if (DIR = '1') then
                   next_state <= S1;
               else
                   next_state <= S3;
               end if;
      
       when S1 =>    if (DIR = '1') then
                   next_state <= S2;
               else
                   next_state <= S0;
               end if;

       when S2 =>    if (DIR = '1') then
                   next_state <= S3;
               else
                   next_state <= S1;
               end if;

       when S3 =>    if (DIR = '1') then
                   next_state <= S0;
               else
                   next_state <= S2;
               end if;

       when others =>    next_state <= S0;

   end case;

end process;

seg <=    "0110000" when (present_state = S0) else    --digit 3
   "0011001" when (present_state = S1) else    --digit 4
   "1000000" when (present_state = S2) else   --digit 0
   "0010010" when (present_state = S2);       --digit 5

A <= seg(0);
B <= seg(1);
C <= seg(2);
D <= seg(3);
E <= seg(4);
F <= seg(5);
G <= seg(6);

end arch;

--Testbench

library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;

entity circuit_function_tb is
end;

architecture bench of circuit_function_tb is

component circuit_function
   port (   DIR   : in std_logic;
       CLK   : in std_logic;
       RST   : in std_logic;
       A, B, C, D, E, F, G : out std_logic
   );
end component;

signal DIR: std_logic;
signal CLK: std_logic;
signal RST: std_logic;
signal A, B, C, D, E, F, G: std_logic ;

constant clock_period: time := 10 ns;
  
begin

uut: circuit_function port map ( DIR => DIR,
CLK => CLK,
RST => RST,
A => A,
B => B,
C => C,
D => D,
E => E,
F => F,
G => G );

stimulus: process
begin
  
   RST <= '1';
   DIR <= '1';

   wait for 20 ns;
  
   RST <= '0';

   wait for 60 ns;

   DIR <= '0';
  
wait;
end process;

clocking: process
begin

CLK <= '0';
wait for clock_period / 2;
CLK <= '1';
wait for clock_period / 2;
end process;

end;

-------------------------------------------------------------

Wave File Edit View Add Format Tools Bookmarks Window Help Wave -Default Msgs erart function-t orcuit_function_tb/RST arcuit

Add a comment
Answer #2
jamkajt5ajt252
source: all subject
answered by: ramsingh bairwa
Add a comment
Know the answer?
Add Answer to:
Write a VHDL code to implement the circuit function described below. Student Id : 8123405 Last 4 digits : 3405 6. Write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits...

    Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal. DIR: Direction of the display sequence, '1 CLK: clock pulse for the display sequence RST: reset the display counter. forward, '0' - reverse. Student ID: 8480594 Vdd ABCDE F G DIR CLK RST For example, if...

  • Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits...

    Write a VHDL code to implement the circuit function described below. 6. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal. DIR: Direction of the display sequence, '1 CLK: clock pulse for the display sequence RST: reset the display counter. forward, '0' - reverse. Student ID: 8243416 Vdd ABCDE F G DIR CLK RST For example, if...

  • 6. Write a VHDL code to implement the circuit function described below. The circuit is to display the last four dig...

    6. Write a VHDL code to implement the circuit function described below. The circuit is to display the last four digits of your student ID number on a 7-segment display, one digit at a time, triggered by the falling edge of the clock signal DIR: Direction of the display sequence, '1'forward, '0'- reverse. CLK: clock pulse for the display sequence. RST: reset the display counter Student ID-8860729 Vdd ABC|DEFG DIR CLK RST For example, if your ID number is 1234567,...

  • .For the following circuit, do: RR3R2R, Ro G G3G2G,Go Write structural VHDL code. Create two files:...

    .For the following circuit, do: RR3R2R, Ro G G3G2G,Go Write structural VHDL code. Create two files: i) flip flop, ii) top file (where you will interconnect the flip flops and the logic gates). Provide a printout. (10 pts) Write a VHDL testbench according to the timing diagram shown below. Complete the timing diagram by simulating your circuit (Behavioral Simulation). The clock frequency must be 100 MHz with 50% duty cycle. Provide a printout. (15 pts) Ro R1 R2 Ro resetn...

  • Please help write VHDL code for these two circuit below First what is this mean VLSI...

    Please help write VHDL code for these two circuit below First what is this mean VLSI related software is reuired this is your comment am asking a simple question write code similar to this question from your website and here is the link similar circuit https://www.chegg.com/homework-help/questions-and-answers/write-vhdl-code-two-sequential-logic-write-vhdl-code-implement-fsm-described-state-graph---q9819429 7. Write VHDL code to implement the FSM described in the state graph below. 0/0 0/0 1/0 0/0 1/0 ifo 1/0

  • Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Af...

    Lab Description Follow the instructions in the lab tasks below to behaviorially create and simulate a flip-flop. Afterwards, you will create a register and use your ALU from Lab 3 to create an accumulator-based processor. This will act ike a simple processor; the ALU will execute si operations and each result will be stored in the register. In an accumulator, the value of the register will be updated with each operation; the register is used as an input to the...

  • Please write in VHDL code: Design the minimal SOP circuit to implement the function F(a,b,c) =...

    Please write in VHDL code: Design the minimal SOP circuit to implement the function F(a,b,c) = MINTERMS(1,5,6,7).Create the gate-level structural architecture named struct1 of your design. Write a testbench to test struct1 above. Hold each input vector constant for 10ns. Your testbench needs verify the correct output for each of the eight input vectors. Your testbench should also include tests for the following transitions: 001->101, 001->110, 001->111, 101->001, 101->110, 101->111, 110->001, 110->101, 110->111, 111->001, 111->101, and 111->110. Hold each of...

  • Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-typ...

    Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-type flip-flops. The counter increases its value on each positive edge of the clock if the Enable signal is asserted. The counter is reset to 0 by setting the Clear signal low. You are to implement an 8-bit counter of this type Enable T Q Clock Clear Figure 1. 4-bit synchronous counter (but you need to implement 8-bit counter in this lab) Specific notes:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT