Skip to content

Commit 9968134

Browse files
committed
introduce tbuf to RT logic
1 parent 3065320 commit 9968134

8 files changed

+116
-89
lines changed

10_HDL/dff.vhd

-28
This file was deleted.

10_HDL/dice555.vhd

-46
This file was deleted.

10_HDL/mcpu_sepdata.vhd

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
--
2+
-- Minimal 8 Bit CPU
3+
--
4+
-- rev 15102001
5+
--
6+
-- 01-02/2001 Tim B"oscke
7+
-- 10 /2001 slight changes for proper simulation.
8+
--
9+
10+
--
11+
12+
library ieee;
13+
use ieee.std_logic_1164.all;
14+
use ieee.numeric_std.all;
15+
-- use ieee.std_logic_unsigned.all;
16+
17+
entity CPU8BIT2 is
18+
port (
19+
datain: in std_logic_vector(7 downto 0);
20+
dataout: out std_logic_vector(7 downto 0);
21+
adress: out std_logic_vector(5 downto 0);
22+
oe: out std_logic;
23+
we: out std_logic; -- Asynchronous memory interface
24+
rst: in std_logic;
25+
clk: in std_logic);
26+
end;
27+
28+
architecture CPU_ARCH of CPU8BIT2 is
29+
-- signal akku: std_logic_vector(8 downto 0); -- akku(8) is carry !
30+
-- signal adreg: std_logic_vector(5 downto 0);
31+
-- signal pc: std_logic_vector(5 downto 0);
32+
-- signal states: std_logic_vector(2 downto 0);
33+
signal akku: unsigned(8 downto 0); -- akku(8) is carry !
34+
signal adreg: unsigned(5 downto 0);
35+
signal pc: unsigned(5 downto 0);
36+
signal states: unsigned(2 downto 0);
37+
begin
38+
process(clk,rst)
39+
begin
40+
41+
if rising_edge(clk) then
42+
43+
if (rst = '0') then
44+
adreg <= (others => '0'); -- start execution at memory location 0
45+
states <= "000";
46+
akku <= (others => '0');
47+
pc <= (others => '0');
48+
else
49+
-- PC / Adress path
50+
if (states = "000") then
51+
pc <= adreg + 1;
52+
adreg <= unsigned(datain(5 downto 0));
53+
else
54+
adreg <= pc;
55+
end if;
56+
57+
-- ALU / Data Path
58+
case states is
59+
when "010" => akku <= ("0" & akku(7 downto 0)) + ("0" & unsigned(datain)); -- add
60+
when "011" => akku(7 downto 0) <= akku(7 downto 0) nor unsigned(datain); -- nor
61+
when "101" => akku(8) <= '0'; -- branch not taken, clear carry
62+
when others => null; -- instr. fetch, jcc taken (000), sta (001)
63+
end case;
64+
65+
-- State machine
66+
if (states /= "000") then states <= "000"; -- fetch next opcode
67+
elsif (datain(7 downto 6) = "11" and akku(8)='1') then states <= "101"; -- branch not taken
68+
else states <= "0" & not unsigned(datain(7 downto 6)); -- execute instruction
69+
end if;
70+
end if;
71+
end if;
72+
end process;
73+
74+
-- output
75+
adress <= std_logic_vector(adreg);
76+
-- data <= "ZZZZZZZZ" when states /= "001" else std_logic_vector(akku(7 downto 0));
77+
dataout <= "11111111" when states /= "001" else std_logic_vector(akku(7 downto 0));
78+
-- dataout <= std_logic_vector(akku(7 downto 0));
79+
oe <= '1' when (clk='1' or states = "001" or rst='0' or states = "101") else '0'; -- no memory access during reset and
80+
we <= '1' when (clk='1' or states /= "001" or rst='0') else '0'; -- state "101" (branch not taken)
81+
82+
end CPU_ARCH;
83+

20_SYNTH/discrete_RT_logic_cells.v

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ output Y;
1010
assign Y = A;
1111
endmodule
1212

13+
module rt_TBUF_N(A, nE, Y);
14+
input A, nE;
15+
output Y;
16+
assign Y = nE ? 1'bZ : A ;
17+
endmodule
18+
1319
module rt_NOT(A, Y);
1420
input A;
1521
output Y;
1622
assign Y = ~A;
1723
endmodule
1824

19-
2025
module rt_XOR2(A, B, Y);
2126
input A, B;
2227
output Y;

20_SYNTH/discrete_RT_logic_liberty.lib

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ library(SingleLogicCells) {
2020
pin(Y) { direction: output;
2121
function: "A"; }
2222
}
23-
23+
24+
cell(rt_TBUF_N) {
25+
area: 3;
26+
pin(A) { direction: input; }
27+
pin(nE) { direction: input; }
28+
pin(Y) { direction: output;
29+
function : "A";
30+
three_state : "~nE"; }
31+
}
32+
2433
cell(rt_NOT) {
2534
area: 1;
2635
pin(A) { direction: input; }

20_SYNTH/discrete_RT_techmap.v

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ LATCH_N _TECHMAP_REPLACE_ (
2727
endmodule
2828

2929
module \$_TBUF_ (input A, input E, output Y);
30-
TBUF _TECHMAP_REPLACE_ (
30+
rt_TBUF_N _TECHMAP_REPLACE_ (
3131
.A(A),
32-
.E(E),
32+
.E(!E),
3333
.Y(Y)
3434
);
3535
endmodule

20_SYNTH/flow_discrete_RT.ys

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tribuf
2121

2222
# Technology mapping
2323
techmap
24+
techmap -map ../20_SYNTH/discrete_RT_techmap.v # map TBUF
2425

2526
# Work around to map DFF with sync set/reset, since this is not possible in liberty file
2627
# proc; opt;

30_PLACE/PCBPlace.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,12 @@ def addlogiccell(self,name,celltype, nets):
602602
self.insertcell(name+"a","rt_NOT", [nets[0], nets[3]])
603603
self.insertcell(name+"b","rt_NOT", [nets[1], nets[3]])
604604
self.insertcell(name+"c","rt_NOT", [nets[2], nets[3]])
605+
elif celltype == "rt_TBUF_N":
606+
self.addlogiccell(name+"a","rt_NOR2", [nets[0] , nets[1], name+"a"])
607+
self.addlogiccell(name+"b","rt_NOT" , [name+"a", nets[2] ])
605608
elif celltype == "rt_DFF": # pin order: C, D, Q
606-
self.insertcell(name+"c#","rt_NOT", [nets[0] , name+"CI"] ) # clock inversion
607-
self.insertcell(name+"d","rt_NOT", [name+"CI", name+"CNI"]) # clock inversion
609+
self.insertcell(name+"c#","rt_NOT", [nets[0] , name+"CI" ]) # clock inversion
610+
self.insertcell(name+"d" ,"rt_NOT", [name+"CI", name+"CNI"]) # clock inversion
608611
self.addlogiccell(name+"a","PHLATCH", [name+"CI" , nets[1] , name+"DI"]) # pin order: E, D, Q
609612
self.addlogiccell(name+"b","PHLATCH", [name+"CNI", name+"DI", nets[2] ]) # pin order: E, D, Q
610613
elif celltype == "PHLATCH": # pin order: E, D, Q
@@ -1129,8 +1132,8 @@ def detailedoptimization(startarray, initialtemp=1, coolingrate=0.95, optimizati
11291132

11301133
# !!! You need to update the lines below to adjust for your design!!!
11311134

1132-
ArrayXwidth = 7 # This is the width of the grid and should be equal to or larger than the number of I/O pins plus two supply pins!
1133-
DesignArea = 70 # This is the number of unit cells required for the design. It is outputted as "chip area" during the Synthesis step
1135+
ArrayXwidth = 28 # This is the width of the grid and should be equal to or larger than the number of I/O pins plus two supply pins!
1136+
DesignArea = 720 # This is the number of unit cells required for the design. It is outputted as "chip area" during the Synthesis step
11341137
# Fixedio fixes I/O positions within the first row. Leave empty if you want the tool to assign positions.
11351138
FixedIO = [] # Default, tool assigns I/O
11361139
# FixedIO = ["VCC","inv_a", "inv_y", "xor_a", "xor_b", "xor_y", "and_a", "and_b", "and_y", "d", "clk", "q"] # for moregates.vhd
@@ -1146,7 +1149,7 @@ def detailedoptimization(startarray, initialtemp=1, coolingrate=0.95, optimizati
11461149

11471150
# Optimizer settings. Only change when needed
11481151

1149-
AreaMargin = 0.5 # This is additional area that is reserved for empty cells. This value should be larger than zero to allow optimization.
1152+
AreaMargin = 0.2 # This is additional area that is reserved for empty cells. This value should be larger than zero to allow optimization.
11501153
# Too large values will result in waste of area. Default: 0.3
11511154
CoarseAttempts = 20 # Default: 20
11521155
CoarseCycles = 1000 # Default: 1000
@@ -1165,12 +1168,12 @@ def detailedoptimization(startarray, initialtemp=1, coolingrate=0.95, optimizati
11651168

11661169
# File names. Don't touch unless you want to modify the flow
11671170

1168-
InputFileName = "209_synthesized_output.sp"
1169-
PCBTemplateFile = "../30_PLACE/board_template.brd"
1170-
PCBOutputFile = "309_board_output.brd"
1171-
SpiceOutputFile = "308_extracted_netlist.sp"
1172-
FanoutOutputFile = "307_fanout.txt"
1173-
NetsOutputFile = "306_nets.csv"
1171+
InputFileName = "209_synthesized_output.sp"
1172+
PCBTemplateFile = "../30_PLACE/board_template.brd"
1173+
PCBOutputFile = "309_board_output.brd"
1174+
SpiceOutputFile = "308_extracted_netlist.sp"
1175+
FanoutOutputFile = "307_fanout.txt"
1176+
NetsOutputFile = "306_nets.csv"
11741177
PlacementOutputFile = "305_placement.csv"
11751178

11761179
# =========== START OF MAIN ===============================

0 commit comments

Comments
 (0)