⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paralla to serials.v.bak

📁 一个关于热敏打印机时序的仿真程序,能够应用于大多数的热敏打印机中,实现了打印数据的并转串.使用Verilog编写,在Modsim下编译通过.并有最终的仿真波形.
💻 BAK
字号:
`timescale 1ns/1nsmodule PtoS(               //output               PR_CLK,               PR_DATA,               //input               CLK,               DATA_CS,               DATA_LATCH,               DATA           );output PR_CLK;output PR_DATA;input  CLK;input  DATA_CS;input  DATA_LATCH;input  [7:0] DATA;//input 8 bit datawire   PR_CLK; //the gate control clkwire   PR_DATA;//the serials data to outputreg    [1:0] flag = 0;reg    [7:0] d; //the memory that store the input datareg    [3:0] count = 0;//note: this will be a problem in synthesisassign PR_CLK  = ((count >= 0) && (count <= 7) && (DATA_CS))? CLK : 1'b0;assign PR_DATA = (DATA_CS)? d[7] : 1'b0;always @(posedge CLK)begin    if(count == 7)    begin        count <= 0;        if(DATA_CS)         begin               if(count < 7)            begin                if(flag == 0)                begin                    count <= 0;                    flag  <= 1;                end                else                    count <= count + 1;            end            if(flag == 1)                flag <= 2;        end    end    endalways @(posedge DATA_LATCH)    d = DATA;always @(posedge PR_CLK)begin    if(count == 0)    begin        if(flag == 1)            d <= {d[6:0],1'b0};        else            d <= d;    end    else if(count <= 7)        d <= {d[6:0],1'b0};endendmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -