Question

In: Electrical Engineering

Using behavioral VHDL, 32-bit up counter with enable.

Using behavioral VHDL, 32-bit up counter with enable.

Solutions

Expert Solution

library IEEE;
use IEEE.std_logic_1164.all;

entity cntr is
  generic(left    : natural := 31;       
          prop    : time := 100 ps);     
  port   (clk     : in  std_logic;
          load    : in  std_logic;
          in_load : in  std_logic_vector (left downto 0);
          output  : out std_logic_vector (left downto 0) );
end entity cntr_g;

architecture behavior of cntr is
begin  
  cntr: process(clk, load)
          variable counter : std_logic_vector(left downto 0);
          variable carry   : std_logic;
          variable tcarry  : std_logic;
        begin
          if load='1' then
            counter := in_load;
            output <= in_load;
          elsif clk'event and clk='1' then 
            carry := '1';
            for i in 0 to left loop
              tcarry  := counter(i) and carry;
              counter(i) := counter(i) xor carry;
              carry := tcarry;
            end loop;
            output <= counter after prop;
          end if;
        end process cntr;
end architecture behavior;

Related Solutions

Using Behavorial VHDL, design a 4-bit up/down counter.
Using Behavorial VHDL, design a 4-bit up/down counter.
Describe in behavioral VHDL a modulo-m up/down counter with the following interface: – Generics • Modulo...
Describe in behavioral VHDL a modulo-m up/down counter with the following interface: – Generics • Modulo base (m with default value of 16) – Inputs Clock (clk  1 bit) Asynchronous reset (rst  1 bit) Counting direction (up_down1 bit) – 1Counting up – 0Counting down – Outputs 2 – Run behavioral simulation • Count value (count • In Vivado – Create a project   bits)
Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency...
Create a VHDL code of a 4 bit Counter using D flip flop and a Frequency Divider that provides the clock signal input for counter
Objective: Design, construct, and test a three-bit counter that counts up or down. An enable input...
Objective: Design, construct, and test a three-bit counter that counts up or down. An enable input E determines whether the counter is on or off.  If E=0, the counter is disabled and remains at its present count even though clock pulses are applied to the flip-flops.  If E=1, the counter is enabled and a second input, x, determines the direction of the count.  If x=1, the circuit counts upward with the sequence 000, 001, 010, 011, 100,...
write sample code in VHDL Design and implementation of Pressetable ripple counter using behavioral style of...
write sample code in VHDL Design and implementation of Pressetable ripple counter using behavioral style of modeling by using pic74196
Write the VHDL codes for (7494) 4 bit shift register using Behavioral style of modeling. this...
Write the VHDL codes for (7494) 4 bit shift register using Behavioral style of modeling. this is the datasheet for this Quation ( http://www.ralphselectronics.com/productimages/SEMI-SN7494N.PDF )
3-(7494) Design and implementation of 4 bit shift register using VHDL Behavioral style of modeling
3-(7494) Design and implementation of 4 bit shift register using VHDL Behavioral style of modeling
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a Verilog module that implements a certain 4-bit counter. The module should include two more input variables: “updown” and “count2”. If “updown” is 1, the circuit should count up (by 1s); if it is 0 it should count down (by 1s). If “count2” has a value of 1, the circuit should instead count up by 2s; otherwise it will have no effect (the circuit counts...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a...
Verilog counter problem: Using the attached 4-bit up-counter module and testbench as a template, write a Verilog module that implements a certain 4-bit counter. The module should include two more input variables: “updown” and “count2”. If “updown” is 1, the circuit should count up (by 1s); if it is 0 it should count down (by 1s). If “count2” has a value of 1, the circuit should instead count up by 2s; otherwise it will have no effect (the circuit counts...
Write VHDL code (behavior model) to implement a 4-bit modulo-9 counter and simulate your VHDL code...
Write VHDL code (behavior model) to implement a 4-bit modulo-9 counter and simulate your VHDL code of 4-bit modulo-9 counter in ModelSim, and capture the screenshot of your simulated waveform. Assume clock period Tclk=100ns, initially, the counter is reset to Q3Q2Q1Q0=0000 you need to simulate a complete counting cycle plus one more additional clock period after it is reset to “0000” state.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT