Skip to content

Commit 41ad9e9

Browse files
committed
fifo: renommage d'entite\n decode: une idee pour eliminer la trasition LINK\n build: petite correction:
1 parent 15b4a19 commit 41ad9e9

File tree

7 files changed

+918
-40
lines changed

7 files changed

+918
-40
lines changed

Decod/decod.vhdl

Lines changed: 81 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ end component;
148148
component fifo_127b
149149
port(
150150
din : in std_logic_vector(126 downto 0);
151-
dout : out std_logic_vector(126 downto 0);
151+
dout : out std_logic_vector(126 downto 0);
152152

153153
-- commands
154-
push : in std_logic;
154+
push : in std_logic;
155155
pop : in std_logic;
156156

157157
-- flags
@@ -400,23 +400,23 @@ begin
400400
empty => dec2exe_empty,
401401
full => dec2exe_full,
402402

403-
reset_n => reset_n,
404-
ck => ck,
405-
vdd => vdd,
406-
vss => vss);
403+
reset_n => reset_n,
404+
ck => ck,
405+
vdd => vdd,
406+
vss => vss);
407407

408408
dec2if : fifo_32b
409-
port map ( din => reg_pc,
409+
port map ( din => reg_pc,
410410
dout => dec_pc,
411411

412-
push => dec2if_push,
413-
pop => if_pop,
412+
push => dec2if_push,
413+
pop => if_pop,
414414

415-
empty => dec2if_empty,
416-
full => dec2if_full,
415+
empty => dec2if_empty,
416+
full => dec2if_full,
417417

418418
reset_n => reset_n,
419-
ck => ck,
419+
ck => ck,
420420
vdd => vdd,
421421
vss => vss);
422422

@@ -506,13 +506,13 @@ begin
506506
if_ir(31 downto 28) = X"9"
507507
else
508508

509-
reg_vv when (if_ir(31 downto 28) = X"6" or
510-
if_ir(31 downto 28) = X"7")
509+
reg_vv when if_ir(31 downto 28) = X"6" or
510+
if_ir(31 downto 28) = X"7"
511511
else
512-
(reg_vv and reg_cznv) when (if_ir(31 downto 28) = X"A" or
512+
(reg_vv and reg_cznv) when if_ir(31 downto 28) = X"A" or
513513
if_ir(31 downto 28) = X"B" or
514514
if_ir(31 downto 28) = X"C" or
515-
if_ir(31 downto 28) = X"D")
515+
if_ir(31 downto 28) = X"D"
516516
else '0';
517517

518518

@@ -582,7 +582,7 @@ begin
582582

583583
flag_wb <= '1' when if_ir(24 downto 23) = '10' and regop_t = '1' --pour les TST, TEQ, CMP
584584
else if(20); --S (comme MOVS mis-a-jour du flag)
585-
585+
586586
-- reg read
587587
-- Rn register
588588
radr1 <= if_ir(15 down 12) when mult_t = '1'
@@ -735,29 +735,86 @@ begin
735735
case cur_state is
736736

737737
when FETCH =>
738+
738739
debug_state <= X"1";
739740
if2dec_pop <= '0';
740741
dec2exe_push <= '0';
741742
blink <= '0';
743+
742744
mtrans_shift <= '0';
743745
mtrans_loop_adr <= '0';
744746

745-
if dec2if_full = '0' and reg_pcv = '1' then
746-
....
747+
if dec2if_full = '1' and dec2if_empty = '0' then
748+
next_state <= FETCH;
749+
else if_pop = '1' then
750+
next_state <= RUN;
751+
else
752+
next_state <= FETCH;
747753
end if;
748754

749755
when RUN =>
750-
751-
when LINK =>
756+
757+
mtrans_shift <= '0';
758+
mtrans_loop_adr <= '0';
759+
760+
761+
dec2if_push <= '1' when reg_pcv = '1' or
762+
dec2if_empty = '1' or
763+
branch_t = '0' -- R14 <= PC+4 au prochain cycle
764+
else 0;
765+
766+
\\ trans all like
767+
768+
-- si la fifo if2dec pas vide, donc on passe a l'inst suivante
769+
if if2dec_empty = '0' then
770+
if2dec_pop <= '1';
771+
else
772+
if2dec_pop <= '0';
773+
end if;
774+
775+
-- on donne la main au prochain cycle horloge le EXEC
776+
if condv = '0' or dec2exe_full = '1' then
777+
dec2exe_push <= '0';
778+
else if operv = '1' and condv = '1' and dec2exe_empty = '1' then
779+
dec2exe_push <= 1;
780+
end if;
781+
782+
-- on change de d'etat
783+
if if2dec_empty = '1' or dec2exe_full = '1' or operv = '0' then
784+
next_state <= RUN;
785+
else if branch_t = '1' then
786+
next_state <= BRANCH;
787+
else if mtrans_t = '1' then
788+
next_state <= MTRANS;
789+
else
790+
next_state = RUN;
791+
end if;
752792

753793
when BRANCH =>
794+
795+
mtrans_shift <= '0';
796+
mtrans_loop_adr <= '0';
797+
798+
if reg_pcv = '1' then
799+
dec2if_push <= '1';
800+
else
801+
dec2if_push <= '0';
802+
end if;
803+
804+
if if2dec_empty = '1' then
805+
next_state = BRANCH;
806+
else if2dec_empty = '0' then
807+
next_state <= RUN;
808+
else
809+
next_state <= BRANCH;
810+
end if;
754811

755812
when MTRANS =>
756-
757-
758-
813+
$$$ dec2exe_push <= '1';
814+
if2dec_pop <= '0';
759815

760816
end case;
817+
761818
end process;
762819

763820
dec_pop <= if2dec_pop;

Fifo/fifo_127b.vhdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LIBRARY ieee;
22
use ieee.std_logic_1164.all;
33

4-
ENTITY fifo IS
4+
ENTITY fifo_127b IS
55
PORT(
66
din : in std_logic_vector(126 downto 0);
77
dout : out std_logic_vector(126 downto 0);
@@ -19,9 +19,9 @@ ENTITY fifo IS
1919
vdd : in bit;
2020
vss : in bit
2121
);
22-
END fifo;
22+
END fifo_127b;
2323

24-
architecture dataflow of fifo is
24+
architecture dataflow of fifo_127b is
2525

2626
signal fifo_d : std_logic_vector(126 downto 0);
2727
signal fifo_v : std_logic;

Fifo/fifo_32b.vhdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LIBRARY ieee;
22
use ieee.std_logic_1164.all;
33

4-
ENTITY fifo IS
4+
ENTITY fifo_32b IS
55
PORT(
66
din : in std_logic_vector(31 downto 0);
77
dout : out std_logic_vector(31 downto 0);
@@ -19,9 +19,9 @@ ENTITY fifo IS
1919
vdd : in bit;
2020
vss : in bit
2121
);
22-
END fifo;
22+
END fifo_32b;
2323

24-
architecture dataflow of fifo is
24+
architecture dataflow of fifo_32b is
2525

2626
signal fifo_d : std_logic_vector(31 downto 0);
2727
signal fifo_v : std_logic;

Fifo/fifo_72b.vhdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
LIBRARY ieee;
22
use ieee.std_logic_1164.all;
33

4-
ENTITY fifo IS
4+
ENTITY fifo_72b IS
55
PORT(
66
din : in std_logic_vector(71 downto 0);
77
dout : out std_logic_vector(71 downto 0);
@@ -19,9 +19,9 @@ ENTITY fifo IS
1919
vdd : in bit;
2020
vss : in bit
2121
);
22-
END fifo;
22+
END fifo_72b;
2323

24-
architecture dataflow of fifo is
24+
architecture dataflow of fifo_72b is
2525

2626
signal fifo_d : std_logic_vector(71 downto 0);
2727
signal fifo_v : std_logic;

Ifetch/ifetch.vhdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ entity IFetch is
1616
if_pop : out Std_Logic;
1717
dec_pc : in Std_Logic_Vector(31 downto 0) ;
1818

19-
if_ir : out Std_Logic_Vector(31 downto 0) ;
19+
if_ir : out Std_Logic_Vector(31 downto 0) ;
2020
if2dec_empty : out Std_Logic;
2121
dec_pop : in Std_Logic;
2222

@@ -34,18 +34,18 @@ architecture Behavior OF IFetch is
3434
component fifo_32b
3535
port(
3636
din : in std_logic_vector(31 downto 0);
37-
dout : out std_logic_vector(31 downto 0);
37+
dout : out std_logic_vector(31 downto 0);
3838

3939
-- commands
40-
push : in std_logic;
40+
push : in std_logic;
4141
pop : in std_logic;
4242

4343
-- flags
4444
full : out std_logic;
4545
empty : out std_logic;
4646

4747
reset_n : in std_logic;
48-
ck : in std_logic;
48+
ck : in std_logic;
4949
vdd : in bit;
5050
vss : in bit
5151
);

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
[ -d "build" ] && rm -fr build
12
mkdir build
23
cp Exec/exec.vhdl build/exec.vhdl
34
cp Makefile.txt build/Makefile
45
cp Ram/ram.vhdl build/ram.vhdl
56
cp Icache/icache.vhdl build/icache.vhdl
6-
cp Dcache/dcache.vhdl build/decache.vhdl
7+
cp Dcache/dcache.vhdl build/dcache.vhdl
78
cp Main/main_tb.vhdl build/main_tb.vhdl
89
cp Core/arm_core.vhdl build/arm_core.vhdl
910
cp Ifetch/ifetch.vhdl build/ifetch.vhdl
@@ -15,5 +16,4 @@ cp Fifo/fifo_32b.vhdl build/fifo_32b.vhdl
1516
cp ALU/alu.vhdl build/alu.vhdl
1617
cp Shifter/shifter.vhdl build/shifter.vhdl
1718
cp Mem/mem.vhdl build/mem.vhdl
18-
cd build
19-
echo "You can makefile and must have 'ghdl' command"
19+
echo "Do makefile in 'build' directory, you must have ghdl"

0 commit comments

Comments
 (0)