Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

calculator disign using key encoder

Status
Not open for further replies.

yasminroseengle

Newbie level 3
Joined
May 12, 2015
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
40
i am making a calculator doing (+ , - , * ,devision) operations using key encoder
i want to make all operations on one circuit using key encoder
the problem is i can do (+ & -) operation using key encoder but i can not add the (* & devision) operation on the same circuit ..as shown
what is the solution plz ?
calca_fsm.png
 

yasminroseengle

Newbie level 3
Joined
May 12, 2015
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
40
Counter:

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- hds header_start
--
-- VHDL Architecture calculator.counter.untitled
--
-- Created:
--          by - Asmaa.UNKNOWN (IDEA-PC)
--          at - 09:47:55 10/04/2015
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2001.5 (Build 170)
--
-- hds header_end
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
 
ENTITY counter IS
-- Declarations
          port(clk,rst,en:in std_logic;
    count:out std_logic_vector(3 downto 0));
 
END counter ;
 
-- hds interface_end
ARCHITECTURE untitled OF counter IS
         signal count_temp:unsigned(3 downto 0);
BEGIN
process(clk,rst)
  begin
    if(rst='1')then
    count_temp<=(others=>'0');
    elsif(rising_edge(clk))then
      if(en='1')then
        count_temp<=count_temp+1;
        end if;
        end if;
        end process;
        count<=std_logic_vector(count_temp);
END untitled;
MUL4_1:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
 
ENTITY Mul4_1 IS
-- Declarations
    port(a:in std_logic_vector(3 downto 0);
        sel :in std_logic_vector(1 downto 0);
           y: out std_logic);
 
 
END Mul4_1 ;
 
 
 
 
 
 
Dec2_4:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
 
ENTITY dec2_4 IS
-- Declarations
 port(a:in std_logic_vector(1 downto 0);
    y:out std_logic_vector(3 downto 0));
 
END dec2_4 ;
 
-- hds interface_end
ARCHITECTURE untitled OF dec2_4 IS
BEGIN
  process(a)
  begin
    if(a="00")then y<="0001";
    elsif(a="01")then y<="0010";
      elsif(a="10")then y<="0100";
      else y<="1000";
      end if;
      end process;
END untitled;



Nodpad:

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- hds header_start
--
-- VHDL Architecture calculator.nodpad.untitled
--
-- Created:
--          by - Asmaa.UNKNOWN (IDEA-PC)
--          at - 09:58:08 10/04/2015
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2001.5 (Build 170)
--
-- hds header_end
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
 
 
ENTITY nodpad IS
-- Declarations
port(Key_pressed: in std_logic_vector(4 downto 0);
    rows:in std_logic_vector(3 downto 0);
    cols:out std_logic_vector(3 downto 0));
 
END nodpad ;
 
-- hds interface_end
ARCHITECTURE untitled OF nodpad IS
BEGIN
 process(rows,Key_pressed)
  variable cols_var:std_logic_vector(3 downto 0);
  begin
    cols_var:="0000";
    if(key_pressed(4)='1')then
      cols_var(conv_integer(unsigned(Key_pressed(1 downto 0)))):=
      rows(conv_integer(unsigned(Key_pressed(3 downto 2))));
    else
      cols_var:="0000";
      end if;
      cols<=cols_var;
      end process;
END untitle

 
Last edited by a moderator:

yasminroseengle

Newbie level 3
Joined
May 12, 2015
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
40
what is wrong in this caluclator simulation ?

i am making a calculator that do ( + , - , divide & multiply ) process
this is the state machine
11212618_1674543352777066_4720843569654700119_o.jpg
11270224_1674543559443712_3713748414587714372_o.jpg11265384_1674541972777204_224591017_o.jpg
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top