RTL code template

设计逻辑在状态机中的流转

来自 <http://blog.csdn.net/xsc_c/article/details/52690201>

modulefsm_using_single_always (
clock , // clock
reset , // Active high, syn reset
req_0 , // Request 0
req_1 , // Request 1
gnt_0 , // Grant 0
gnt_1
);
//=============Input Ports=============================
input clock,reset,req_0,req_1;
//=============Output Ports===========================
output gnt_0,gnt_1;
//=============Input ports Data Type===================
wire clock,reset,req_0,req_1;
//=============Output Ports Data Type==================
reg gnt_0,gnt_1;
//=============Internal Constants======================
parameter SIZE =3 ;
parameter IDLE = 3'b001,GNT0 = 3'b010,GNT1 = 3'b100 ;
//=============Internal Variables======================
reg [SIZE-1:0] state ;// Seq part of the FSM
reg [SIZE-1:0] next_state ;// combo part of FSM
//==========Code startes Here==========================
always @ (posedgeclock)
begin : FSM
if (reset == 1'b1)begin
state <= #1 IDLE;
gnt_0 <= 0;
gnt_1 <= 0;
end else
case(state)
IDLE : if (req_0 == 1'b1) begin
state <= #1 GNT0;
gnt_0 <= 1;
end else if (req_1 == 1'b1) begin
gnt_1 <= 1;
state <= #1 GNT1;
end else begin
state <= #1 IDLE;
end
GNT0 : if (req_0 == 1'b1) begin
state <= #1 GNT0;
end else begin
gnt_0 <= 0;
state <= #1 IDLE;
end
GNT1 : if (req_1 == 1'b1) begin
state <= #1 GNT1;
end else begin
gnt_1 <= 0;
state <= #1 IDLE;
end
default : state <= #1 IDLE;
endcase
end

endmodule // End ofModule arbiter

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Vue中实现在线编辑Word文档,可以使用一些现有的编辑器库,如CKEditor或Quill。这些库提供了许多常见的文本编辑功能,并且可以通过Vue组件进行集成。以下是一些基本的步骤: 1. 安装编辑器库: ```bash npm install vue-quill-editor ``` 或者 ```bash npm install vue-ckeditor5 ``` 2. 在Vue组件中引入并注册编辑器组件: ```javascript import { VueEditor } from 'vue-quill-editor'; // 或者 import CKEditor from '@ckeditor/ckeditor5-vue'; export default { components: { VueEditor, // 或者 CKEditor }, // ... }; ``` 3. 在模板中使用编辑器组件: ```html <template> <div class="editor"> <vue-editor v-model="content" :options="editorOptions" /> </div> </template> ``` 或者 ```html <template> <div class="editor"> <ckeditor :editor="editor" v-model="content" /> </div> </template> ``` 4. 配置编辑器选项: ```javascript export default { data() { return { content: '', editorOptions: { placeholder: '请输入内容', modules: { toolbar: [ ['bold', 'italic', 'underline', 'strike'], ['blockquote', 'code-block'], [{ header: 1 }, { header: 2 }], [{ list: 'ordered' }, { list: 'bullet' }], [{ script: 'sub' }, { script: 'super' }], [{ indent: '-1' }, { indent: '+1' }], [{ direction: 'rtl' }], [{ size: ['small', false, 'large', 'huge'] }], [{ header: [1, 2, 3, 4, 5, 6, false] }], [{ color: [] }, { background: [] }], [{ font: [] }], [{ align: [] }], ['clean'], ], }, }, }; }, // ... }; ``` 以上是基本的实现方法,当然还可以根据具体需求进行更详细的配置和自定义。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值