latex 流程图

\documentclass[UTF8]{ctexart}
\usepackage{tikz,mathpazo}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{calc} 
\begin{document}
\thispagestyle{empty}
 % 流程图定义基本形状
\tikzstyle{process} = [rectangle, minimum width=4cm, minimum height=1cm, draw=black, fill=pink!30]
\tikzstyle{decision} = [diamond, minimum width=8cm, minimum height=0.5cm, text centered, draw=black, fill=red!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}[node distance=2cm]
%定义流程图具体形状
\node (M1) [process] {PC $\rightarrow$ AR , PC+1};
\node (M2) [decision,below of= M1,yshift=-2cm] {RAM $\rightarrow$ IR,指令译码};
\node (M3_RET) [process,right of= M2,xshift=2cm,yshift=-5cm] {SP $\rightarrow$ AR};
\node (M4_RET) [process,below of= M3_RET] {RAM $\rightarrow$ PC};
\node (M5_RET) [process,below of= M4_RET] {SP $\rightarrow$ $DA_1$};
\node (M6_RET) [process,below of= M5_RET] {$DA_1$+1 $\rightarrow$ SP};

\node (M3_CALL) [process,left of= M2,xshift=-2cm,yshift=-4cm] {PC $\rightarrow$ AR,PC+1};
\node (M4_CALL) [process,below of= M3_CALL] {RAM $\rightarrow$ $DA_2$};
\node (M5_CALL) [process,below of= M4_CALL] {SP $\rightarrow$ $DA_1$};
\node (M6_CALL) [process,below of= M5_CALL] {$DA_1-1$ $\rightarrow$ SP};
\node (M7_CALL) [process,below of= M6_CALL] {$DA_2$ $\rightarrow$ PC};

%连接具体形状
\draw [arrow](M1) -- (M2);
\draw [arrow](M2) -- node[anchor=west,xshift=4cm] {RET} ($(M2.south)$) -|(M3_RET);
\draw [arrow](M3_RET) -- (M4_RET);
\draw [arrow](M4_RET) -- (M5_RET);
\draw [arrow](M5_RET) -- (M6_RET);
\draw [arrow](M6_RET) -- ($(M6_RET.east) +(1,0)$) |-(M1);

\draw [arrow](M2) -- node[anchor=east,xshift=-4cm] {CALL} ($(M2.south)$) -|(M3_CALL);
\draw [arrow](M3_CALL) -- (M4_CALL);
\draw [arrow](M4_CALL) -- (M5_CALL);
\draw [arrow](M5_CALL) -- (M6_CALL);
\draw [arrow](M6_CALL) -- (M7_CALL);
\draw [arrow](M7_CALL) -- ($(M7_CALL.west) +(-1,0)$) |-(M1);


% \draw [arrow](M) -- (M2);
\end{tikzpicture}
\end{document}

  • 12
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BoneInscri

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值